Hi all,

I have seen that in PHP there are some functions that allow adding some
field=value pairs to the QUERY_STRING, automaticly for all the links from a
page and also in forms.

This might be helpful when I want to add the session id to the query_string
like &cgisessid=[session id].

Do you know if there are some modules that can make this with perl?

I think it wouldn't be too complicate to do it manually, but it would be
more simple to make it using a module, something like:

use ModuleName;
my $module = ModuleName->new();
$module->replace_all($text_of_page, 'cgisessid', '[session id]');

And these lines should replace the text of the page contained in
$text_of_page, in such a way that:

<a href="test.pl">Test</a>
will become:
<a href="test.pl?cgisessid=[session id]">Test</a>

and

<a href="test.pl?var1=val1">Test</a>
will become:
<a href="test.pl?var1=val1&cgisessid=[session id]">Test</a>

and

<a href="test.pl?cgisessid=[another session id]">Test</a>
will become:
<a href="test.pl?cgisessid=[session id]">Test</a>

and

<form action="/cgi-bin/test.pl" method="POST">
<input type="text" name="q" />
<input type="submit" value="Ok" />
</form>

will become:

<form action="/cgi-bin/test.pl" method="POST">
<input type="hidden" name="cgisessid" value="[session id]" />
<input type="text" name="q" />
<input type="submit" value="Ok" />
</form>


Is there any perl module that does this, or something similar? It would be
great to be and I am almost sure it should be.

I know that this method could have some issues that should be solved in
other way, for example in the case of the records taken from a database and
sent directly to the browser, or when $| = 1... but for many other cases of
scripts that send the text buffered, it should work fine.

Thank you for any help.

PS. It would be wonderful if the module CGI::Session would have the option
for doing this.

Teddy


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to