in reply to Module programming
However, you did ask, so--this seems to work. I've only done B.pm, not C.pm, because they should be quite similar if I understand what you're asking.
Here's A.pm (your $i_am_the_problem is now called $problem):
Here's B.pm:package A; use strict; use vars qw/@EXPORT @ISA $problem/; use Exporter; @ISA = qw/Exporter/; @EXPORT = qw/$problem/; 1;
And here's a small script that sets $problem, then calls the exported function foo:package B; use strict; use vars qw/@ISA @EXPORT/; use A; use Exporter; @ISA = qw/Exporter/; @EXPORT = qw/foo/; sub foo { print "problem is $problem\n" } 1;
That said, again: you really may want to rethink your code design.use A; use B; $problem = "bar"; foo();
|
|---|