Whether you can have, or cannot have, package variables is unrelated to whether the package variables are scalars or hashes, or whether they are exported or not.
Note also that if mod_perl means you cannot have globals, it would mean you cannot have Perl. Certain global variables always exist.
The issue with mod_perl is that modules get only compiled "once" (well, typically, once in the life time of an Apache child), and not each time the program is run. This means "globals" may not get (re)initialized. But that is not the same as package variables!. File scoped lexicals and sub-bounded state variables won't get (re)initialized either. And package variables that get initialized in your mod_perl program do get initialized.
The mod_perl issue all has to do when certain code is run - not whether variables are package variables or lexicals.
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.