[cgiapp] bug report: 'make test' fails when $HEADERS_ONCE of CGI.pm globals modified

Rhesa Rozendaal perl at rhesa.com
Mon Jul 7 15:33:09 EDT 2008


Mark Stosberg wrote:
> Here we have one of the extremely rare CGI::Application bug reports. 
> 
> Someone has modified a CGI.pm global, which is why the tests are
> failing. 

I find it almost bizarre that that's actually suggested in the CGI.pm docs. It 
sounds like a very bad practice to me, especially since CGI provides an import 
pragma for almost all of those globals.

Note that the only two explicitly documented package variables are $POST_MAX 
and $DISABLE_UPLOADS, which are probably irrelevant to the test suite.

> I have some inclination to consider this "not our bug". For someone who
> has modified these globals, it may in fact be useful feedback to know to
> that CGI::Application behaves different than usual in that case, and
> thus it's appropriate for the tests to fail. 

I'd be inclined to say that as well. You really can't account for all the 
possible things that could happen when people hack CPAN modules. It's hard 
enough to keep track of all the different official versions as it is.

> Alternatively, we could force lots of CGI.pm globals back to their
> default state in state in the test suite. 

That would be a maintenance hazard.

I'd probably opt for recommending against hacking up CPAN modules, and to use 
the documented ways of customizing behavior. Altering package globals is a 
great way to produce unwanted action at a distance, and we all know how evil 
that is.

In this case, the reporter could have opted for

   use CGI qw/ -unique_headers /;

Rhesa


More information about the cgiapp mailing list