Beefy Boxes and Bandwidth Generously Provided by pair Networks kudra
Don't ask to ask, just ask
 
PerlMonks  

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

by merlyn (Sage)
on May 03, 2001 at 21:09 UTC ( [id://77778]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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

Replies are listed 'Best First'.
Re: Re: Re: Re (tilly) 3: No excuses about not using CGI.pm
by MeowChow (Vicar) on May 03, 2001 at 21: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
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.