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

How does one setup a module so that adding an array argument selective imports part of the subroutines in it for use without package qualification.

Replies are listed 'Best First'.
Re: use Data::DRef qw( :leaf );
by snowcrash (Friar) on May 16, 2000 at 18:40 UTC
    use the Exporter module and declare sets of stuff you want to export in an %EXPORT_TAGS hash, like this:
    package Foo; use strict; use vars qw(@ISA @EXPORT %EXPORT_TAGS); use Exporter; @ISA = qw(Exporter); %EXPORT_TAGS = ( TAG1 => [qw(F1 F2 Func)], TAG2 => [qw(%bar @baz)], );
    now you can:
    use Foo qw(:TAG1 %baz);
    to import all symbols in TAG1 and %baz.

      You can also use @EXPORT and @EXPORT_OK; @EXPORT exports what you assign to it every time, and @EXPORT_OK means it's ok to export something, but you have to specify it explicitly to import it.

      Just look at the Exporter manpage, it's got all you ever wanted to know.