in reply to Export in perl
:DEFAULT covers all of @EXPORT. For @EXPORT_OK, each element that you want must be called individually: hence, distribute won't be exported. I would do your script like this:use YourModule qw(:DEFAULT collect @list);
package YourModule; use strict; use warnings; use Exporter; BEGIN { $Exporter::Verbose = 1; } our (@ISA, @EXPORT, @EXPORT_OK); BEGIN { require Exporter; @ISA = qw(Exporter); @EXPORT = qw(shuffle @card_deck); @EXPORT_OK = qw(collect @list); } use YourModule qw(:DEFAULT collect @list); our @list = qw(ace jack queen king); sub shuffle { return "shuffle is done\n"; } sub distribute { return "distribute is OK\n"; } sub collect { return "collect is finished\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Export in perl
by ikegami (Patriarch) on Feb 07, 2011 at 22:42 UTC | |
|
Re^2: Export in perl
by Anonymous Monk on Feb 07, 2011 at 21:33 UTC |