in reply to Best way to generate URLs in CGI script?
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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Best way to generate URLs in CGI script?
by bikeNomad (Priest) on Jul 27, 2001 at 07:31 UTC | |
by shotgunefx (Parson) on Jul 27, 2001 at 23:48 UTC |