Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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

by merlyn (Sage)
on May 04, 2001 at 01:09 UTC ( [id://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

Replies are listed 'Best First'.
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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://77778]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-03-28 19:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found