Any code in your script that is not in a subroutine will be executed serially. All the
package directive does is say, "OK, now assume a default namespace of X for everything I declare." The code is still executed straight through the file.
Things like use and require can be reduced to do with additional logic. All you're doing is loading an external file and executing it in-line (though use does this in the equivalent of a BEGIN { } block, so in a way this all happens before anything else is executed in your script). Usually you see a package declaration in these files, which cause the new subroutines to be declared in a new namespace, but otherwise code that isn't in a subroutine is executed like any other.
I'm over-simplifying here, since a file is a 'block' with respects to variable scoping, but that's about the only thing multiple files do that's different.
The bottom line is that since your additional code towards the bottom isn't declared in a subroutine, it will never be reached because you are dieing. A package directive doesn't do all that much, and certainly doesn't do what you think it does.
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.