Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: No excuses about not using CGI.pm

by grinder (Bishop)
on May 03, 2001 at 19:45 UTC ( #77682=note: print w/ replies, xml ) Need Help??


in reply to No excuses about not using CGI.pm
in thread variables not posting?

Furthermore, if you don't like looking at all that scary stuff at the beginning of your script, you can place those BEGIN { } code blocks at the end of your script. Won't make a whiff of difference, it'll run just the same.

Randal is right, heed his advice.


--
g r i n d e r


Comment on Re: No excuses about not using CGI.pm
Download Code
Re: Re: No excuses about not using CGI.pm
by merlyn (Sage) on May 03, 2001 at 19:49 UTC
    Not quite. The import can import prototypes, which need to sucked in before the rest of the code is compiled. Maybe not true for CGI.pm in particular, but I like to show a general template that can be copied for other problems without fear.

    -- Randal L. Schwartz, Perl hacker

      Actually in general I consider avoiding unexpected prototype conversion a good thing. In which case having a good way to silently ignore unwanted prototypes (and trust me, I rarely want them) is a good thing!
        But it's not silent (under -w):
        mysub(1); BEGIN { package Foo; require Exporter; @ISA = qw(Exporter); @EXPORT = qw(mysub); sub mysub ($) { print "mysub: @_\n" }; } BEGIN { Foo->import(); } ## Output main::mysub() called too early to check prototype at C:\Projects\GPerl +\Test\g1.pl line 1. mysub: 1
        Though I don't quite understand, if BEGIN blocks are executed before the rest of the containing file is parsed (so sayeth perlmod), why does this happen at all?
           MeowChow                                   
                       s aamecha.s a..a\u$&owag.print

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://77682]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2014-12-25 02:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (159 votes), past polls