http://www.perlmonks.org?node_id=1029898


in reply to Re^3: How to export a package sitting lower in a module?
in thread How to export a package sitting lower in a module?

Corion: note that the two packages are sitting in the same module file.
Like I said, it's not straightforward to export from a package which sits lower in a module. Please try to run this module: it doesn't work - it gives errors:
# Name of this file: pack_A.pm package pack_A; use strict; require Exporter; @ISA = qw {Exporter}; @EXPORT = qw {first second}; sub first { } sub second { } 1; #end package pack_A; package pack_B; use strict; require Exporter; @ISA = qw {Exporter}; @EXPORT = qw {third fourth}; sub third { } sub fourth { } 1; #end package pack_B; #end of file pack_A.pm
with the main script:
use pack_B;
# or use pack_A; ?
third();