Hi All,

NB: after composing this email, I checked URI's RT queue and noticed "Query
separator is hard-coded to be '&'" [1] -- which is the same issue. Maybe
it's important to revisit it.

I was testing an app at the command line which does some query and URL
manipulation. At one point, I pass the URL as generated from CGI.pm, which
happens to use a semi-colon (rather than an ampersand) as the query
parameter separator. Once I tried to access the params from the hash URI
returns from query_form(), I noticed that there was only 1 param instead of
the many more I was expecting.

Here's some sample code to reproduce the error.

use strict;
use warnings;

use CGI;
use URI;
use Data::Dumper;

my $query  = CGI->new( { a => '1', b => '2' } );
my $url    = $query->url( -query => 1 );
my $uri    = URI->new( $url );
my %params = $uri->query_form;


print Dumper \$url;
print Dumper \%params;

__END__
$VAR1 = \'http://localhost/t.pl?a=1;b=2';
$VAR1 = {
          'a' => '1;b=2'
        };

One not so great workaround is to set:

$CGI::USE_PARAM_SEMICOLONS = 0;

...which will force CGI.pm to use ampersands. The above program with that
line added gives me:

$VAR1 = \'http://localhost/t.pl?a=1&b=2';
$VAR1 = {
          'a' => '1',
          'b' => '2'
        };

-Brian

[1] http://rt.cpan.org/NoAuth/Bug.html?id=27


http://www.gordano.com - Messaging for educators.

Reply via email to