Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: any way to fill calling namespace with a "use Module"?

by Corion (Pope)
on Feb 23, 2013 at 19:46 UTC ( #1020337=note: print w/ replies, xml ) Need Help??

in reply to any way to fill calling namespace with a "use Module"?

I would restructure the object hierarchy as follows:

package Top::Base; use Moose; 1; package SubordinateA; use Moose; extends 'Top::Base'; 1; package SubordinateB; use Moose; extends 'Top::Base'; 1;

... and then introduce a new "Top" class that doesn't inherit from Moose and whose ->new method is just a factory for the others:

package Top; sub new { my ($class, %options) = @_; my $impl= "Top::$options{ base }"; $impl->new( %options ); };

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2016-08-25 20:57 GMT
Find Nodes?
    Voting Booth?
    The best thing I ever won in a lottery was:

    Results (362 votes). Check out past polls.