Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Exporting symbols from another package

by Hue-Bond (Priest)
on Mar 29, 2010 at 20:36 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-26 00:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found