Normally, if a package uses some other module, the symbols are only imported for the package's use. With the caller function, a crafty meta-package can emulate the use statements on behalf of the main script. This can make the Library more friendly to use and document.
package Library; ... sub import { my $calling = (caller())[0]; eval qq{ # Load these on behalf of the calling package. package $calling; use Library::This; use Library::That; use Library::TheOther::Thing; }; die $@ if $@; }
In reply to Meta Module imports several packages by halley
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |