in reply to 'use strict;' between libraries
Most of your problem here is caused by having subroutines that are only called for their side effects on global variables. A better approach would probably be to use subroutines which return values.
#!/usr/bin/perl # pie.pl use strict; my $pie; require "b.pl"; $pie = &getpied; print "The pie says : $pie\n";
and
#!/usr/bin/perl # b.pl use strict; sub getpied { return "eat me"; } 1;
An even better approch would be to look into turning b.pl into a real module.
Update: Oops. Just saw the part where you said
Using return is not an option, as I have a whole lot of variables that has to be available in about 8 different scripts.
(thanks to Skeeve for pointing it out)
In that case, you really need to turn b.pl into a module and use Exporter.
--"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: 'use strict;' between libraries
by Skeeve (Parson) on Jul 16, 2003 at 12:42 UTC | |
by bobn (Chaplain) on Jul 16, 2003 at 13:00 UTC | |
by Skeeve (Parson) on Jul 17, 2003 at 11:26 UTC | |
by macPerl (Beadle) on Jan 28, 2004 at 17:41 UTC |