it is skipped because it has already been require'd.
Exactly. Modules are only executed the first time they are required.
That's the case for use as well, but it also calls the module's import method (if it has one). This is where your code belongs, and the code you need is provided by Exporter already.
# TEST.pm package TEST; BEGIN { our @EXPORT_OK = qw( test_sub ); our @ISA = qw( Exporter ); require Exporter; } sub test_sub { print "Hello, world!\n"; }
# TEST2.pm package TEST2; use TEST qw( test_sub ); 1;
# Main script use TEST2; use TEST qw( test_sub ); test_sub();
In reply to Re: Requiring libraries that export subroutines, and are required by other libraries... Exported subs cannot be found?
by ikegami
in thread Requiring libraries that export subroutines, and are required by other libraries... Exported subs cannot be found?
by RP31
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |