tcf03 has asked for the wisdom of the Perl Monks concerning the following question:
now - Id like to have several packages all using $a and $b so what Id like to do is something likepackage foo; use strict; require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw( $a, $b ); our $a = 1; our $b = 2; 1; package bar; use strict; require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw( $a, $b ); our $a = 99; our $b = 7775; 1; #!/usr/bin/perl use strict; use warnings; use foo; &a sub a { do something to $a; do something to $b }
and call it like script.pl foo#!/usr/bin/perl use strict; use warnings; use $ARGV[0]; blah blah blah
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: modules as variables
by davido (Cardinal) on Jun 28, 2006 at 18:24 UTC | |
by ikegami (Patriarch) on Jun 28, 2006 at 18:50 UTC | |
by tcf03 (Deacon) on Jun 28, 2006 at 18:29 UTC | |
by davido (Cardinal) on Jun 28, 2006 at 18:31 UTC | |
|
Re: modules as variables
by Solo (Deacon) on Jun 28, 2006 at 18:35 UTC | |
by tcf03 (Deacon) on Jun 28, 2006 at 18:43 UTC | |
|
Re: modules as variables
by ikegami (Patriarch) on Jun 28, 2006 at 18:58 UTC | |
|
Re: modules as variables
by shmem (Chancellor) on Jun 28, 2006 at 18:31 UTC | |
|
Re: modules as variables
by davidrw (Prior) on Jun 28, 2006 at 18:26 UTC |