in reply to Create a package that exports other packages

I copy/paste, you pick the winner :)

Import::Into, ex::override ,Override the open builtin globally.. redux, Re: Selectively importing warnings (works), Re: how to make lexical pragma global, hints ( pl_hints $^H %^H ), taint::all (package taintall)

and some of these

perl5, perl5::ingy
ToolSet
Syntax::Collector
Toolkit
rig
see perlrun#PERL5OPT , PERLLIB, PERL5LIB
sitecustomize under perlrun#* f*
how to make lexical pragma global, hints ( pl_hints $^H %^H ), taint::all, Re: batch 'use' possible? (perl5.pm Toolset.pm, Syntax::Collector , Toolkit.pm, rig.pm, sitecustomize.pl, PERL5OPT )( load multiple commonly-used favorite modules in a single import expression )

export into / Import::Into

 

:D

  • Comment on Re: Create a package that exports other packages

Replies are listed 'Best First'.
Re^2: Create a package that exports other packages
by exilepanda (Friar) on Aug 06, 2014 at 08:06 UTC
    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