in reply to Re^2: One module to use them all (proxy moudle that exports subs of other modules)
in thread One module to use them all (proxy moudle that exports subs of other modules)

Based on choroba's ++reply, here's a (partial?) solution (?) that may be closer to what you want.

tldr.pl:

# from choroba pm#11146644 (modified) use warnings; use strict; use ModAll; print "'$_' \n" for Foo::bar(qw(some stuff)), m1(), m2('whatever'), m3 +;
ModAll.pm:
# from choroba pm#11146644 (modified) package ModAll; use warnings; use strict; # use Data::Dump qw(dd); # for debug use constant USE_ALL => qw(Mod1 Mod2 Mod3 Foo); eval "use $_" for USE_ALL; use Exporter 'import'; our @EXPORT = map eval, map "\@${_}::EXPORT", USE_ALL ; __PACKAGE__
Mod1.pm:
package Mod1; use warnings; use strict; use Exporter 'import'; our @EXPORT = qw( m1 ); sub m1 { "m1(@_)" } __PACKAGE__
Mod2.pm:
package Mod2; use warnings; use strict; use Exporter 'import'; our @EXPORT = qw( m2 ); sub m2 { "m2(@_)" } __PACKAGE__
Mod3.pm:
package Mod3; use warnings; use strict; use Exporter 'import'; our @EXPORT = qw( m3 ); sub m3 { "m3(@_)" } __PACKAGE__
Foo.pm (forgot this previously):
# Foo.pm package Foo; use strict; use warnings; sub bar { sprintf "hiya from -%s-(@_) invoked from '%s'", (caller 0)[3, 0]; } 1;
Invocation:
Win8 Strawberry 5.8.9.5 (32) Fri 09/02/2022 19:51:48 C:\@Work\Perl\monks\nataraj >perl tldr.pl 'hiya from -Foo::bar-(some stuff) invoked from 'main'' 'm1()' 'm2(whatever)' 'm3()'
(Caution: There may be some important phasing considerations in my version of ModAll.pm that I'm overlooking!)

Update: Forgot to list the Foo.pm module. It's listed elsewhere, but I've added it here for completeness.


Give a man a fish:  <%-{-{-{-<

  • Comment on Re^3: One module to use them all (proxy moudle that exports subs of other modules) (updated)
  • Select or Download Code