My take, with one of the sub-modules being Exporter-based, the second using its own import(), and the One Module still being able to figure out how to bind them together and tell the world what to do:

11146642-tldr.pl

#!perl use 5.012; # //, strict, say use warnings; use FindBin; use lib "$FindBin::Bin/lib"; use Mod11146642::All; # Mod11146642::One uses Exporter # Mod11146642::Two uses manual import() # but both work through Mod11146642::All oneFunction(); twoFunction();

Mod11146642/All.pm

package Mod11146642::All 1.00; use 5.012; # //, strict, say use warnings; use Exporter 5.47 qw(import); my %colons; my @inherited; BEGIN { $colons{$_} = $_ for keys %::Mod11146642::All::; } use Mod11146642::One; use Mod11146642::Two; BEGIN { for (sort keys %::Mod11146642::All::) { next if /^__ANON__$/; # ignore anonymous functions next if exists $colons{$_}; # ones that were in the namesp +ace before weren't inherited push @inherited, $_; # if we're here, we inherited +this } # local $" = ","; warn "inherited (@inherited)\n"; # un-comment + this line if you want to debug the ineritance check } our @EXPORT = @inherited; 1;

Mod11146642/One.pm

package Mod11146642::One 1.00; use 5.012; # //, strict, say use warnings; use Exporter 5.47 qw(import); our @EXPORT = qw(oneFunction); sub oneFunction { local $" = ","; printf STDERR "Called %s(@_)\n", (caller(0))[3]; } 1;

Mod11146642/Two.pm

package Mod11146642::Two 2.00; use 5.012; # //, strict, say use warnings; sub twoFunction { local $" = ","; printf STDERR "Called %s(@_)\n", (caller(0))[3]; } sub import { my ($pkg) = @_; my $callpkg = caller(0); no strict 'refs'; my $exportfunction = $callpkg . '::twoFunction'; *{$exportfunction} = \&twoFunction; } 1;

In reply to Re: One module to use them all (proxy moudle that exports subs of other modules) by pryrt
in thread One module to use them all (proxy moudle that exports subs of other modules) by nataraj

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.