in reply to Re: "use Foo.pm" twice from inside different packages...
in thread "use Foo.pm" twice from inside different packages...
Just a minor note on the difference in our solutions with respect to Exporter: Perl 5.6 and earlier require Exporter to be subclassed, not just imported.
use Exporter qw(import); # Perl >= 5.8 use base 'Exporter'; # Perl <= 5.6
Even my solution isn't backwards-compatible prior to Perl 5.6 because I included our and warnings. For personal use, this may not matter, but module authors who plan to publish should keep it in mind.
Update: For Perl >=5.8 I changed the example to note that you need to specify import.
-xdg
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: "use Foo.pm" twice from inside different packages...
by japhy (Canon) on Mar 02, 2006 at 22:15 UTC | |
|
Re^3: "use Foo.pm" twice from inside different packages...
by ikegami (Patriarch) on Mar 02, 2006 at 23:12 UTC | |
|
Re^3: "use Foo.pm" twice from inside different packages...
by wazoox (Prior) on Mar 03, 2006 at 12:04 UTC | |
by xdg (Monsignor) on Mar 03, 2006 at 12:13 UTC | |
by wazoox (Prior) on Mar 03, 2006 at 12:44 UTC | |
by xdg (Monsignor) on Mar 03, 2006 at 13:31 UTC | |
by wazoox (Prior) on Mar 03, 2006 at 14:39 UTC |