Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: How to use variables from other package?

by Chmrr (Vicar)
on Apr 27, 2003 at 06:15 UTC ( #253451=note: print w/ replies, xml ) Need Help??

in reply to How to use variables from other package?

Lexical variables (those created with my) do not show up in the symbol table, and thus can't be accessed via the $Packagename::variable syntax. In this case (assuming perl 5.6.0 or later), you'll want to do:

package CNLLog; our $_POST_CONVERSION = "postConversion"; our $_CORRECTIVE_SCRIPTS = "correctiveScripts";

..and in the other file..


Older versions of perl will need to use the use vars pragma. See perldoc vars.

Update: One should also mention the wonderful article Coping with Scoping, by MJD. See also 'our' is not 'my'.

perl -pe '"I lo*`+$^X$\"$]!$/"=~m%(.*)%s;$_=$1;y^`+*^e v^#$&V"+@( NO CARRIER'

Comment on Re: How to use variables from other package?
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://253451]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2015-11-26 14:05 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (701 votes), past polls