Your skill will accomplish what the force of many cannot |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I have a script that calls a function in a module, and inside the module a global variable is defined. The function in the module tests the value of the global variable inside a try{} block. When the global is declared using "my", the variable is undefined inside the try{}. If I change the declaration to "our", or access the variable outside the try{} but inside in the normal scope of the function, then the variable is defined correctly. It seems like the initialization of the variable is optimized out, that the code in the try{} isn't analyzed when the function is initialized. I am trying to understand why this is the case, and whether this is expected behavior or not. Using Perl 5.8.3. Thanks, Calling script:
Module: global_stuff.pm:
In reply to global variable initialization inside try{} by legova
|
|