Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Re: Re (tilly) 3: No excuses about not using CGI.pm

by merlyn (Sage)
on May 04, 2001 at 01:09 UTC ( #77778=note: print w/ replies, xml ) Need Help??


in reply to Re: Re (tilly) 3: No excuses about not using CGI.pm
in thread variables not posting?

You got it in the wrong order. You can't execute a BEGIN block before you compile it, and you compile it in the order in the file. So you've compiled the lone mysub at the top, then you compile the first BEGIN block, then execute it, then compile the second BEGIN block, then execute it and OOPS! there's the problem.

Put the lone mysub at the bottom of the file, and it'll be all good.

-- Randal L. Schwartz, Perl hacker


Comment on Re: Re: Re (tilly) 3: No excuses about not using CGI.pm
Re: Re: Re: Re (tilly) 3: No excuses about not using CGI.pm
by MeowChow (Vicar) on May 04, 2001 at 01:37 UTC
    Right, I was commenting on tilly's statement that reversing the order is a good way to silently ignore the prototype.

    However, I wonder if the documentation in perlmod should be revised from:

    A BEGIN subroutine is executed as soon as possible, that is, the moment it is completely defined, even before the rest of the containing file is parsed.
    To something like:
    A BEGIN subroutine is executed as soon as possible, that is, the moment it is completely defined, even before subsequent code is parsed, but after the code before it is parsed and compiled.
       MeowChow                                   
                   s aamecha.s a..a\u$&owag.print
      I can't think of a time I would have expected it to be parsed before the code ahead of it is parsed. I mean, the compiler doesn't skip around willy-nilly in the source file!

      Are you familiar with languages where the parser skips around? And if so, where does it skip to without, uh, parsing the file? {shrug}

      -- Randal L. Schwartz, Perl hacker

        Well, the operative words were "parsed and compiled".
           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://77778]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (9)
As of 2014-12-21 16:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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





    Results (106 votes), past polls