in reply to Module dependency
As an example:
# package.pm $var = 'a variable'; sub mySub { print "called!\n"; } 1; ################# # script.pl use package; mySub(); print "Var: " . $var . "\n"; exit 0;
You should note, however, that this isn't always the best behaviour -- frequently, you might want to define multiple namspaces/packages/modules in order to avoid being stuck with a load of globals in a thousand-line script...
It is generally (at least AFAIK) considered much nicer to place things in the @EXPORT_OK array rather than the @EXPORT array where they are automatically dumped into my progam's namespace.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: Module dependency
by Fastolfe (Vicar) on Sep 07, 2000 at 18:06 UTC | |
by jreades (Friar) on Sep 07, 2000 at 18:31 UTC | |
by Fastolfe (Vicar) on Sep 07, 2000 at 22:43 UTC |