in reply to Understanding $CGI::Q
from perldoc CGI
If you import any of the state-maintaining CGI or form-generating meth- ods, a default CGI object will be created and initialized automatically the first time you use any of the methods that require one to be present. This includes param(), textfield(), submit() and the like. (If you need direct access to the CGI object, you can find it in the global variable $CGI::Q). By importing CGI.pm methods, you can create visually elegant scripts:
But you referred to $CGI::Q before calling any of the methods noted.
Better to do away with the $CGI::Q and literally create it with:
after use CGI.... Especially since you're using it in $q->param.) Or do without the object altogether, which you could, because you imported the :standard methods in your use CGI qw/:standard/; statement. But you also are NOT using it for some of your other functions, which is confusing.my $q = CGI->new;
I generally import nothing, create the CGI object $q and use it for all methods. It'sa less confusing to me, even though it adds line noise.
--Bob Niederman, http://bob-n.com
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Understanding $CGI::Q
by daniel808 (Initiate) on Jul 15, 2003 at 23:44 UTC |