in reply to Conditional inheritance strategy
few notes:
use dispatch map
use dispatch map
you can call foreign methods ...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); }
$self->My::JSON::_init; # or my $method = $self->{engine} . '::_init'; $self->$method;
|
---|
In Section
Seekers of Perl Wisdom