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

I'd like to create a hierarchy of perl modules based on a directed acyclical graph (a branching tree). Each node would become a class which would automagically have methods allowing it to access to any of the nodes below it on the tree (it's transitive closure).

I'm pretty sure I know how to inject methods into a package via it's symbol table, but can anyone point me in the right direction for further reading about how to dynamically create packages in perl.

Replies are listed 'Best First'.
Re: Dynamic Packages in Perl
by chromatic (Archbishop) on Nov 14, 2008 at 17:58 UTC
Re: Dynamic Packages in Perl
by Joost (Canon) on Nov 14, 2008 at 18:11 UTC

      Whoops!

      This assigns the string 'Bla::Dee' to the scalar ${""} in package main.

      To do what you intend, say

      ${$package_name.'::PARENT'} = "Bla::Dee";
Re: Dynamic Packages in Perl
by zentara (Cardinal) on Nov 14, 2008 at 18:04 UTC