[cgiapp] Discrepancy between CGI and CGI::Simple

Mark Stosberg mark at summersault.com
Mon Feb 27 09:29:23 EST 2012


On 02/19/2012 04:39 PM, Ron Savage wrote:
> Hi Folks
> 
> Firstly, the code:
> <===8><===>
> #!/usr/bin/env perl
> 
> use feature 'say';
> 
> use CGI;
> use CGI::Simple;
> 
> # --------------
> 
> say 'CGI: ', CGI -> new -> redirect;
> say 'CGI::Simple: ', CGI::Simple -> new -> redirect;
> <===8><===>
> 
> Then the output:
> <===8><===>
> CGI: Status: 302 Found
> Location: http://localhost
> 
> 
> CGI::Simple: Status: 302 Moved
> Location: http://localhost/home/ron/bin/x.pl
> 
> <===8><===>
> 
> It's the 302 line I'm interested in. Is this discrepancy by design or not?

As someone who has done some review and maintenance of both modules,
it's hard to say.

CGI::Simple forked a long time ago and they haven't stayed in sync. I've
found that both has some fixes that the other has lacked. (Although I've
done work to minimize them).

In this case, I would compare each against it's own docs. If the docs
differ about the expected behavior, then I would say it's by design. If
the docs don't differ, one of them have a bug.

<looks>

In this case, it looks like the behavior of redirect() with no arguments
is "undefined" in both cases.

It's tempting to suggest that they should both be throwing an error in
this case, as it's not clear what a "default" redirect() should be.

   Mark




More information about the cgiapp mailing list