linuxfan has asked for the wisdom of the Perl Monks concerning the following question:
I have created a library called util.pm which contains a bunch of subroutines. A few perl scripts make use of this library by doing
I wish to have a few variables in util.pm that can also be visible in the perl scripts. However, perl will not let me do this - perl scripts having the above block are only able to aceess the subroutines in util.pm and not the variables.BEGIN { my $dir = dirname($0); require "$dir/../util.pm"; }
One option is have the standard @EXPORT_OK stuff and have my scripts do "use util.pm".
Is there any other method to achieve what I want?
Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using variables declared in a library from other perl scripts
by GrandFather (Saint) on Apr 19, 2007 at 00:00 UTC | |
by Anno (Deacon) on Apr 19, 2007 at 08:59 UTC | |
by GrandFather (Saint) on Apr 19, 2007 at 19:06 UTC | |
by linuxfan (Beadle) on Apr 19, 2007 at 00:21 UTC | |
|
Re: Using variables declared in a library from other perl scripts
by chromatic (Archbishop) on Apr 18, 2007 at 23:53 UTC |