I'm still confused. I don't see how, if the "new" happens before "has", ..:)blah..

because line 7 (new) and line 10 (say) come before line 15 (has) and all three come after each use line

read use , require, do, eval, BEGIN, UNITCHECK, CHECK, INIT and END

Re: Non-traditional, Line by Line Compilation in Perl

#!/usr/bin/perl # begincheck print "10. Ordinary code runs at runtime.\n"; END { print "16. So this is the end of the tale.\n" } INIT { print " 7. INIT blocks run FIFO just before runtime.\n" } UNITCHECK { print " 4. And therefore before any CHECK blocks.\n" } CHECK { print " 6. So this is the sixth line.\n" } print "11. It runs in order, of course.\n"; BEGIN { print " 1. BEGIN blocks run FIFO during compilation.\n" } END { print "15. Read perlmod for the rest of the story.\n" } CHECK { print " 5. CHECK blocks run LIFO after all compilation.\n" } INIT { print " 8. Run this again, using Perl's -c switch.\n" } print "12. This is anti-obfuscated code.\n"; END { print "14. END blocks run LIFO at quitting time.\n" } BEGIN { print " 2. So this line comes out second.\n" } UNITCHECK { print " 3. UNITCHECK blocks run LIFO after each file is compiled.\n" } INIT { print " 9. You'll see the difference right away.\n" } print "13. It merely _looks_ like it should be confusing.\n" +; __END__ 1. BEGIN blocks run FIFO during compilation. 2. So this line comes out second. 3. UNITCHECK blocks run LIFO after each file is compiled. 4. And therefore before any CHECK blocks. 5. CHECK blocks run LIFO after all compilation. 6. So this is the sixth line. 7. INIT blocks run FIFO just before runtime. 8. Run this again, using Perl's -c switch. 9. You'll see the difference right away. 10. Ordinary code runs at runtime. 11. It runs in order, of course. 12. This is anti-obfuscated code. 13. It merely _looks_ like it should be confusing. 14. END blocks run LIFO at quitting time. 15. Read perlmod for the rest of the story. 16. So this is the end of the tale.

Maybe I shouldn't be worrying, but I'm scared there's a trap lying in wait for me.

:D  while( $fear ){ LEARN: { perldoc(); test(); }; $fear--; }


In reply to Re^3: Moo error message not understood (begincheck.pl) by Anonymous Monk
in thread Moo error message not understood by davies

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.