Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Create a package that exports other packages

by exilepanda (Friar)
on Aug 06, 2014 at 08:06 UTC ( [id://1096399]=note: print w/replies, xml ) Need Help??


in reply to Re: Create a package that exports other packages
in thread Create a package that exports other packages

BIG THANKS!! Import::Into works like a charm!!! It goes exactly I would expect and feel really transparent!
# X.pm package X; sub new { bless{ Name=> "I am X"}, shift} 1; #Y.pm package Y; require Exporter; our @ISA =qw/Exporter/; our @EXPORT_OK = qw/TestY/; sub new {bless{ Name=> "I am Y"}, shift;} sub TestY {print "@_ EXPORT_OK"} 1; #MyStuffs.pm package MyStuffs; use Import::Into; sub import { my $target = caller; X->import::into($target); Y->import::into($target, qw/TestY/); } 1; #main.pl use MyStuffs; use Data::Dumper; my $x = new X; my $y = new Y; print "X dumps: "; print Dumper $x; print "$/$/Y dumps: "; print Dumper $y; print "$/$/"; TestY("I am"); print "$/"; Y::TestY ( "Still" ) ; __END__ X dumps: $VAR1 = bless( { 'Name' => 'I am X' }, 'X' ); Y dumps: $VAR1 = bless( { 'Name' => 'I am Y' }, 'Y' ); I am EXPORT_OK Still EXPORT_OK

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2026-04-23 00:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.