Discussion:
[Mason-devel] CGIHandler Bug
David Wheeler
2005-10-22 22:17:46 UTC
Permalink
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
Dave Rolsky
2005-10-25 04:03:40 UTC
Permalink
Post by David Wheeler
% $m->print($ARGV{test});
After way too much debugging, I noticed this. You wrote ARGV instead of
ARGS.


-dave

/*===================================================
VegGuide.Org www.BookIRead.com
Your guide to all that's veg. My book blog
===================================================*/
Kineticode Billing
2005-10-25 14:21:45 UTC
Permalink
Post by Dave Rolsky
After way too much debugging, I noticed this. You wrote ARGV
instead of ARGS.
Oh, well then I'm a moran[1]. :-(

However, changing it to $ARGS{test}, I'm still getting undef instead
of 'foo'. :-( Do you get 'foo'?

David

1. Loading Image...
David Wheeler
2005-10-25 14:28:39 UTC
Permalink
On Oct 25, 2005, at 9:19 AM, Kineticode Billing wrote:
^^^^^^^^^^^^^^^^^^

*Really* a moran. :-(

D
Dave Rolsky
2005-10-25 18:16:24 UTC
Permalink
Post by Kineticode Billing
Post by Dave Rolsky
After way too much debugging, I noticed this. You wrote ARGV instead of
ARGS.
Oh, well then I'm a moran[1]. :-(
However, changing it to $ARGS{test}, I'm still getting undef instead of
'foo'. :-( Do you get 'foo'?
Yes, I do.


-dave

/*===================================================
VegGuide.Org www.BookIRead.com
Your guide to all that's veg. My book blog
===================================================*/
David Wheeler
2005-10-25 18:21:26 UTC
Permalink
Post by Dave Rolsky
Yes, I do.
Crap. Okay, thanks. Back to the drawing board, and sorry for the
wasted time.

David

Loading...