in reply to Re^2: Creating dynamic parent/child relationships
in thread Creating dynamic parent/child relationships
Just a quick follow up to show a crude way of getting this done by passing the order of the classes into the base class:
package Base ; sub new { my $class = shift; for my $mod (@_) { eval "require $mod"; } bless { steps => \@_ }, $class; } sub do { my $s = shift; print "hi from Base\n"; for my $step ( @{ $s->{steps} } ) { $step->do; } }
Then call construct new from a script:
my $base = Base->new( qw ( One Three Two ) ); $base->do;
$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks
|
|---|