CGIHandler Bug

David Wheeler <[email protected]> Sat, 22 Oct 2005 17:15:13 -0700
Newsgroups gmane.comp.web.mason.devel
Message-ID <[email protected]>
Masonites,

For this script:



#!/usr/bin/perl -w

use strict;
use Test::More tests => 3;
use CGI qw(-no_debug);
use HTML::Mason::CGIHandler;

$ENV{PATH_INFO} = '/dhandler';
$ENV{REQUEST_METHOD} = 'GET';
my $output;
ok my $cgih = HTML::Mason::CGIHandler->new(
     comp_root    => shift @ARGV,
     out_method   => \$output,
), 'Construct CGIHandler object';

$ENV{QUERY_STRING} = 'test=foo';

ok $cgih->handle_request, 'Handle simple callback request';
is $output, 'foo';
__END__

Where /dhandler has only these two lines:

% print STDERR "# dhandler executing\n";
% $m->print($ARGV{test});

Outputs:

1..3
ok 1 - Construct CGIHandler object
# dhandler executing
Content-Type: text/html; charset=ISO-8859-1

ok 2 - Handle simple callback request
not ok 3
#   Failed test in /Users/david/bin/try at line 19.
#          got: undef
#     expected: 'foo'
# Looks like you failed 1 test of 3.

As you can see, the dhandler *is* executing, put the parameter in $ENV 
{QUERY_STRING} doesn't seem to be making it into %ARGS. But it's not  
a CGI problem because this script passes:

#!/usr/bin/perl -w

use strict;
use Test::More tests => 2;
use CGI qw(-no_debug);

$ENV{PATH_INFO} = '/dhandler';
$ENV{REQUEST_METHOD} = 'GET';
$ENV{QUERY_STRING} = 'test=foo';

ok my $q = CGI->new, 'New CGI';
is $q->param('test'), 'foo', 'Check param';
__END__

HTML::Mason 1.31 and CGI.pm 3.11. Any ideas? Things seem to work fine  
in ApacheHandler.

Thanks,

David




-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information