Subject: | -oldstyle_urls pragma not persisted under mod_perl 2 |
The documentation states that the oldstyle_urls pragma can be used to
force the use of ampersands to delimit querystring pairs generated by
url() and self_url():
Under mod_perl 2, this only works for the first invocation of
ModPerl::Registry scripts.
use CGI qw/-oldstyle_urls/;
my $cgi = CGI->new;
warn $cgi->url(-absolute => 1, query => 1);
Assuming the script above is accessed as e.g.
"/script.pl?name1=value1&name2=value2", the first invocation returns
something like
/script.pl?name1=value1&name2=value2
Subsequent invocations return this instead:
/script.pl?name1=value1;name2=value2
CGI::new() contains the following line:
$r->pool->cleanup_register(\&CGI::_reset_globals);
_reset_globals() calls initialize_globals(), which sets
$CGI::USE_PARAM_SEMICOLONS to 1, overriding anything that may have been
supplied via the oldstyle_urls pragma. The fact that this happens at
request cleanup explains why the first request is not affected.