wtd has asked for the wisdom of the Perl Monks concerning the following question:
package Simple; use strict; use warnings; use Exporter; my @ISA = qw(Exporter); my %EXPORT_TAGS = ("all" => [qw(&hello)]); Exporter::export_ok_tags("all"); sub hello { print "Hello\n"; } 1;
Now, in theory, the following should work.
perl -Mstrict -Mwarnings -e "use Simple qw(:all); &hello"However, I get the following error.
Undefined subroutine &main::hello called at -e line 1.Am I incorrect in thinking that exporting "hello" means it should end up in the main package?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Am I doing something wrong with Exporter?
by bart (Canon) on Dec 04, 2004 at 09:29 UTC | |
by wtd (Initiate) on Dec 05, 2004 at 01:48 UTC |