Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 43462
Status: rejected
Priority: 0/
Queue: CGI

People
Owner: Nobody in particular
Requestors: EDAVIS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: CGI::url_param without parens causes a syntax error, but CGI::param is okay
% perl -MCGI -Mstrict -e 'CGI::param'; % perl -MCGI -Mstrict -e 'CGI::url_param'; Bareword "CGI::url_param" not allowed while "strict subs" in use at -e line 1. Execution of -e aborted due to compilation errors. Why the inconsistency? It is a bit confusing that CGI::param can be used like this but CGI::url_param cannot.
On Fri Feb 20 08:01:25 2009, EDAVIS wrote: Show quoted text
> % perl -MCGI -Mstrict -e 'CGI::param'; > % perl -MCGI -Mstrict -e 'CGI::url_param'; > Bareword "CGI::url_param" not allowed while "strict subs" in use at -e > line 1. > Execution of -e aborted due to compilation errors. > > Why the inconsistency? It is a bit confusing that CGI::param can be > used like this but CGI::url_param cannot.
The inconsistency is because as a performance issue, param() is loaded by default, but url_param() is not. When you call it without parens, there is no way to know that you mean to refer to a method, so that it could be possibly be loaded on demand. If you tell CGI to import everything up front, then you get consistent behavior and no warning: perl -MCGI=:all -Mstrict -e 'CGI::url_param'; But I don't recommend that, I recommend using the OO interface. For now I'm marking this bug report as "rejected", because CGI.pm is working as intended here. Mark