in reply to RE: Beginnings of Online CGI Course
in thread Beginnings of Online CGI Course
new CGI is easily misunderstood. Some even suggest that you should write CGI::->new() to prevent CGI->new() being interpretted as main::CGI()->new(), which is possible. I'm not completely decided on that last point because I don't think it is supported in moderately old versions of Perl and I feel that I can usually avoid having functions that have the same name as modules that I use. I will probably convert to CGI::->new() before too long, though.
So let's consider:
What if you do this from a package? You probably have a new() method of your own and now you've (probably) done:my $q= new CGI;
I think there are also gotchas with regard to confusing precedence, but I don't recall them.my $q= new( "CGI" );
So many (including me) suggest that you always avoid "indirect object" notation. This might also apply to the standard:
which should instead be written:print HANDLE "Stuff\n";
but I've not seen that point pushed much. I personally think that things will slowly migrate that direction, though. - tye (but my friends call me "Tye")HANDLE->print( "Stuff\n" );
|
|---|