The trick -- if you really want to use CGI.pm to do this -- is to override what CGI.pm believes the script name is, which can be done temporarily with local...
use CGI '-oldstyle_urls'; my $cgi1 = CGI->new; { local $ENV{'SCRIPT_NAME'} = '/graph'; my $cgi2 = CGI->new({ 'channel' => 1, 'size' => 400, 'ysize' => 300, }); print $cgi2->url( -query_string => 1 ), "\n"; } print $cgi1->url( -query_string => 1 ), "\n";
The only caveat is to be really careful with your scoping: put the wrong thing in the wrong place, and it prolly won't work the way you expect.
--k.
In reply to Re: Best way to generate URLs in CGI script?
by Kanji
in thread Best way to generate URLs in CGI script?
by bikeNomad
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |