in reply to One module to use them all (proxy moudle that exports subs of other modules)

I made a fairly complete solution to this problem with Exporter::Extensible.
package MyMod1; use Exporter::Extensible -exporter_setup => 1; sub foo :Export( :default ) { 42 }
package MyMod2; use Exporter::Extensible -exporter_setup => 1; sub bar :Export( :default ) { 43 }
package MyMod3; use parent qw( MyMod1 MyMod2 );
perl -I. -MMyMod3 -E 'say foo'
However, I also recommend that you don't export things by default. It isn't much more to type use MyMod3 ':all'; and then it gives you more flexibility in the future to choose fewer imports.
package MyMod1; use Exporter::Extensible -exporter_setup => 1; sub foo :Export { 42 }
package MyMod2; use Exporter::Extensible -exporter_setup => 1; sub bar :Export { 43 }
package MyMod3; use parent qw( MyMod1 MyMod2 );
perl -I. -MMyMod3=:all -E 'say foo'

Replies are listed 'Best First'.
Re^2: One module to use them all (proxy moudle that exports subs of other modules)
by hippo (Archbishop) on Sep 04, 2022 at 21:40 UTC
    However, I also recommend that you don't export things by default.

    This. Polluting other people's namespaces is just rude. That isn't the Perl way. Permit the import - don't enforce it.


    🦛