Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Conditional inheritance strategy

by happy.barney (Pilgrim)
on Oct 28, 2010 at 09:52 UTC ( #867968=note: print w/replies, xml ) Need Help??


in reply to Conditional inheritance strategy

few notes:
use dispatch map
our $dispatch_map = { xml => 'My::XML', json => 'My::JSON', }; sub new { ... die unless exists $dispatch_map->{$args{source}}; my $class = $dispatch_map->{$args{source}} Module::Load::load ($class); $self->{engine} = $class; # or $class->new ($self); }
you can call foreign methods ...
$self->My::JSON::_init; # or my $method = $self->{engine} . '::_init'; $self->$method;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://867968]
help
Chatterbox?
[marto]: good morning all, TCIF
[Discipulus]: TCIF & chips marto! and sane dots too
[Corion]: Hi marto ;) All Hail Crunchy!

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2017-02-24 09:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (353 votes). Check out past polls.