The camel book goes in to a bit more detail in chapter 18, Compiling, when describing the life cycle of a perl program. I'll try to summarize here but basically you are correct.
First, the program is compiled into a parse tree. Any BEGIN blocks encountered along the way are handed to the interpreter as soon as they are compiled in a FIFO order.
Next, in the (optional) code generation phase, any CHECK blocks are run..."CHECK blocks are installed by code geneerators, so this optional phase occurs when you explicitly use one of the code generators...These convert the compiled (but not yet run) program into either C source code or serialized Perl bytecodes..."
Next the parse tree is reconstructed if needed (depending on what happened above)
Finally the execution phase comes (run phase). Just before the main program itself starts running the INIT blocks are run in FIFO order, then the main program itself runs.
I hope I got that all right, since I don't know a whole lot about the code generation phase and parse tree reconstruction phase (and CHECK blocks), so perhaps someone else can elaborate further on that.
If you are really interested in this, I would highly suggest the Camel book, Programming Perl 3rd Edition as it goes in to a lot more detail which is hard to describe here. It also happens to be an excellent book.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.