jeanluca has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks

I've create the following snippet of code:
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS, $Verbose, $FOR +MAT) ; @ISA = qw(Exporter); @EXPORT = (); @EXPORT_OK = qw( sub1 sub2 ) ; %EXPORT_TAGS = ( DEFAULT => [qw(&sub1)], Both => [qw(&sub1 &sub2)]); $VERSION = 1.0 ; $Verbose = 0 ;
But when I tried to use it like:
use MyModule qw(:DEFAULT)
I cannot use sub1. However when I do
use MyModule qw(:Both)
both subs are available.
I just noticed that when I change my module a bitl DEFAULT to Default it works great!
Any suggestions whats happening here ?

Thanks a lot in advance
Luca

Replies are listed 'Best First'.
Re: @EXPORT_TAG not working
by Fletch (Bishop) on Mar 13, 2006 at 15:33 UTC

    If you read the documentation for Exporter you'll see that it notes that the :DEFAULT tag is generated from the contents of @EXPORT.

    [!]name This name only [!]:DEFAULT All names in @EXPORT [!]:tag All names in $EXPORT_TAGS{tag} anonymous li +st [!]/pattern/ All names in @EXPORT and @EXPORT_OK which m +atch

    Your tag in %EXPORT_TAGS is never seen.

Re: @EXPORT_TAG not working
by japhy (Canon) on Mar 13, 2006 at 15:35 UTC
    You don't define :DEFAULT. The Exporter docs say that :DEFAULT means "whatever is in @EXPORT".

    Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
    How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart