Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Exporting symbols from another package

by Hue-Bond (Priest)
on Mar 29, 2010 at 20:36 UTC ( #831702=note: print w/replies, xml ) Need Help??

in reply to Exporting symbols from another package

When I wanted to achieve something like that, this is what I did:

package Foo::One; use warnings; use strict; use base qw/Foo Exporter/; our @EXPORT_OK = qw/action1/; sub action1 { ... } package Foo::Two; use warnings; use strict; use base qw/Foo Exporter/; our @EXPORT_OK = qw/action2/; sub action2 { ... } package Foo; MHT::One->import (qw/action1/); MHT::Two->import (qw/action2/); our %EXPORT_TAGS = ( One => [qw/action1/], Two => [qw/action2/], ); Exporter::export_ok_tags keys %EXPORT_TAGS;

And later:

use Foo qw/:One :Two/;

Which is basically what BrowserUk suggests.

 David Serrano
 (Please treat my english text just like Perl code, i.e. feel free to notify me of any syntax, grammar, style and/or spelling error. Thank you!).

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://831702]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2016-10-21 17:26 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (289 votes). Check out past polls.