Click here to get back home

Exporting dependency methods

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Exporting dependency methods Brian Huntington 11-10-2004
Posted by Brian Huntington on November 10, 2004, 8:14 am
Please log in for more thread options
Hello,

Within my custom module, I would like to export dependency module's
methods. Example of code is as follows:

package My::Mod;

use strict;
use Perl::Distrib qw(:all);

use vars qw(@ISA etc.);
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw();
@EXPORT_OK = qw(&subOne &subTwo);
%EXPORT_TAGS = (all => [@EXPORT_OK]);

Now, how do I get $Perl::Distrib::EXPORT_TAGS into
$My::Mod::EXPORT_TAGS so that any time I "use My::Mod" in the
calling script, Perl::Distrib methods come along with it, avoiding the
necessity of '&My::Custom::perl_dist_method' in the calling script.

Any advice would be great. Thanks,
Brian H.


Posted by Brian McCauley on November 10, 2004, 8:02 pm
Please log in for more thread options


Brian Huntington wrote:

> Hello,
>
> Within my custom module, I would like to export dependency module's
> methods. Example of code is as follows:
>
> package My::Mod;
>
> use strict;
> use Perl::Distrib qw(:all);
>
> use vars qw(@ISA etc.);
> require Exporter;
> @ISA = qw(Exporter);
> @EXPORT = qw();
> @EXPORT_OK = qw(&subOne &subTwo);
> %EXPORT_TAGS = (all => [@EXPORT_OK]);
>
> Now, how do I get $Perl::Distrib::EXPORT_TAGS into
> $My::Mod::EXPORT_TAGS so that any time I "use My::Mod" in the
> calling script, Perl::Distrib methods come along with it,

Does Perl::Distrib use the standard Exporter? If so have you tried to
"just do it"? i.e. copy @} into the
list of exports from My::Mod.

# Untested
@EXPORT_OK = (qw(&subOne &subTwo) ,@});



Posted by Brian Huntington on November 11, 2004, 7:48 am
Please log in for more thread options
> Brian Huntington wrote:
>
> > Hello,
> >
> > Within my custom module, I would like to export dependency module's
> > methods. Example of code is as follows:
> >
> > package My::Mod;
> >
> > use strict;
> > use Perl::Distrib qw(:all);
> >
> > use vars qw(@ISA etc.);
> > require Exporter;
> > @ISA = qw(Exporter);
> > @EXPORT = qw();
> > @EXPORT_OK = qw(&subOne &subTwo);
> > %EXPORT_TAGS = (all => [@EXPORT_OK]);
> >
> > Now, how do I get $Perl::Distrib::EXPORT_TAGS into
> > $My::Mod::EXPORT_TAGS so that any time I "use My::Mod" in the
> > calling script, Perl::Distrib methods come along with it,
>
> Does Perl::Distrib use the standard Exporter? If so have you tried to
> "just do it"? i.e. copy @} into the
> list of exports from My::Mod.
>
> # Untested
> @EXPORT_OK = (qw(&subOne &subTwo) ,@});


Brian,

Your suggestion worked excellently! Thank you. And yes, I did "just do
it" but I tried adding de-refing the array in the %EXPORT_TAGS hash (I
can't tell you how many syntactical varieties I tried!) instead of the
@EXPORT_OK list. One line up, and I woulda had it.

Thanks for your time.

Brian


Similar ThreadsPosted
querying modules dependency tree on CPAN November 19, 2004, 1:54 am
Question on platform dependency of ExtUtils::Command::MM (file globbing) December 17, 2006, 7:49 am
Log::Dispatch - How to "die" a script after all other methods are called??? September 6, 2005, 4:55 pm
calling methods on deserialized objects August 25, 2006, 4:32 pm
trickiness (?) calling regular subroutines from OO methods August 23, 2004, 11:16 am
Passing Environment and ExtUtils::MakeMaker options to CPAN methods August 5, 2005, 8:42 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap