(I'm not trying to say they have to be nested like that, just that there is no automatic nesting done for you.)
Example:
All this applies if you are not exporting anything. If you want things from Bar to export to script, you can either set up Bar to export them (so they are imported to Foo) and Foo to export them also (so they are imported to script); or use Abigail's suggestion of export_to_level (see Exporter doc) to do it in one fell swoop.$ cat script.pl use strict; use warnings; use Foo; print "calling Foo::mysub\n"; Foo::mysub(); print "calling Bar::mysub\n"; Bar::mysub(); $ cat Foo.pm package Foo; use strict; use warnings; use Bar; sub mysub { print "I'm a sub in ", __PACKAGE__, "\n" } 1; $ cat Bar.pm package Bar; use strict; use warnings; sub mysub { print "I'm a sub in ", __PACKAGE__, "\n" } 1; $ perl script.pl calling Foo::mysub I'm a sub in Foo calling Bar::mysub I'm a sub in Bar
In reply to Re: Loading modules through one main module?
by ysth
in thread Loading modules through one main module?
by stonecolddevin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |