Dru has asked for the wisdom of the Perl Monks concerning the following question:
package Test::Parser; use strict; use Exporter; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); sub test1 { print "New message for test1\n"; } sub test2 { print "New message for test2\n"; } my %lists = ( 'test1' => \&test1, 'test2' => \&test2 ); @ISA = qw(Exporter); $VERSION = 0.1; @EXPORT = qw(%lists); # What's allowed to be exported @EXPORT_OK = qw(%lists); 1;
#!/usr/bin/perl -w # # tmp.pl # use strict; use Test::Parser; for my $key (keys %lists) { $lists{$key}->(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: First Time Creating a Package, Am I doing this Right?
by Fletch (Bishop) on Oct 05, 2004 at 15:59 UTC | |
by Dru (Hermit) on Oct 05, 2004 at 16:16 UTC | |
by Ven'Tatsu (Deacon) on Oct 05, 2004 at 18:26 UTC | |
|
Re: First Time Creating a Package, Am I doing this Right?
by revdiablo (Prior) on Oct 05, 2004 at 16:28 UTC | |
|
Re: First Time Creating a Package, Am I doing this Right?
by johnnywang (Priest) on Oct 05, 2004 at 18:23 UTC | |
|
Re: First Time Creating a Package, Am I doing this Right?
by tachyon (Chancellor) on Oct 06, 2004 at 07:17 UTC |