in reply to Want to create a common Perl module
Something like this might work in principle:
package abc; use strict; use warnings; use File::Path (); ... sub import { my $caller = caller(); strict->import(); warnings->import(); { eval "package $caller; File::Path->import('mkpath');" } ... } 1;
One of the problems is that Exporter, from which many modules inherit the import() method, uses caller to determine where to export to... That's the reason for the eval, because the calling package that you have to mimic for this in abc's import() will only be known at runtime.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Want to create a common Perl module
by pankaj41483 (Initiate) on Jun 28, 2010 at 14:33 UTC | |
by almut (Canon) on Jun 28, 2010 at 14:41 UTC | |
by pankaj41483 (Initiate) on Jun 28, 2010 at 14:47 UTC | |
by almut (Canon) on Jun 28, 2010 at 15:31 UTC |