in reply to How to use variables from other package?
The classic way to do this is to export those variables via Exporter.
package Foo; use base 'Exporter'; use vars qw( @ISA @EXPORT_OK $foo ); @EXPORT_OK = qw( $foo ); $foo = 3;
And then in your code:
use Foo qw($foo); print $foo;
Note that the qw() operator is used. Those are strings being quoted, not variables. See perldoc Exporter for more information.
Cheers,
Ovid
New address of my CGI Course.
Silence is Evil (feel free to copy and distribute widely - note copyright text)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How to use variables from other package?
by Anonymous Monk on Apr 27, 2003 at 17:06 UTC | |
by integral (Hermit) on Apr 27, 2003 at 17:34 UTC | |
by chromatic (Archbishop) on Apr 27, 2003 at 19:55 UTC | |
by integral (Hermit) on Apr 27, 2003 at 20:01 UTC | |
|
Re: Re: How to use variables from other package?
by Juerd (Abbot) on Apr 28, 2003 at 06:44 UTC |