Hellow fellow monks.
My question may seem rather simple but I haven't found the anwser either in perl documentation and the super search.
Here is my problem, I have a bigger script wich let's say uses 3 different modules, these 3 modules are only used in some subrutines so we can assume:
Module1, Module2, Module3
sub1, sub2, sub3
The sub 1 uses only Module1 and Module1 is not used anywhere else in the script, the equivalent is for sub2 and sub3. Now my question is of this nature:
Where should I include my modules? If I put the use Module1; use Module2; use Module3; on top of my script I assume that it will be loaded for the whole script witch is not what I want becouse it is only used in some subrutines, not the whole script. I was thinking about puting use Module1; inside sub1 code blocks but three questions came to me as I pondered about it.
Question 1, will the module be loaded for the whole script or just this sub?
Question 2, will the module be loaded each time I call the sub, or maybe just once on startup, or will it be loaded only once when I first time call the sub?
Question 3, if I i put use Module1; inside the subrutines code blocks, will the module be unloaded when the subrutine ends?
Thank you for the time you all sacrificed to read this node ( or maybe even anwser it ;) ) and I hope that none of you will be offended by such a simple question ( well simple for you beacouse my mind seems rather confused by this case ;) ).
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.