http://www.perlmonks.org?node_id=11105504

nysus has asked for the wisdom of the Perl Monks concerning the following question:

Let's say I have the following parent/child relationships:

package One; package Two; use parent 'One'; package Three; use parent 'Two';

But then let's say I write a fourth package that I sometimes, but not always, want to insert between the second and third packages:

package One; package Two; use parent 'One'; package Four; use package 'Two'; package Three; use parent 'Four';

So I need some kind of good system to tell package Three when I want it to use package Two sometimes and package Four other times. And it can get a lot more complicated than this. I might have a total of 10 different packages. One day I might need to chain packages 1->3->5->6 and another day I might need to chain packages 2->7->5->3->8.

I'm thinking I'll need some kind of configuration file to dictate which packages get used and in what order. But how would I go about dynamically changing the the use parent command so that it is variable? Can I do a BEGIN block which will pull from the configuration file and then set a variable which can be used in the the use parent directive?

$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