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

Re: Creating dynamic parent/child relationships

by haj (Curate)
on Sep 03, 2019 at 10:31 UTC ( #11105511=note: print w/replies, xml ) Need Help??


in reply to Creating dynamic parent/child relationships

I don't think I understand how you want to insert a fourth package "sometimes, but not always" in the hierarchy of package Three. Is this for different programs using the same package Three, for different runs of the same program, for different modules in one program which use package Three - or for different objects within the same program? Does the decision happen when you write your code, or at compile time, or at run time?

If the decision happens at runtime on a per-object base: I once had such a problem and found Moose with its roles to be a suitable approach (because the program used introspection anyway). Thanks to its meta protocol, Moose allows to add roles (which would be your intermediate packages) to existing objects, so objects can "learn new tricks during runtime".

If the decision happens once for a program run, I'd go for a plugin mechanism as suggested by Corion in Re: Creating dynamic parent/child relationships.

  • Comment on Re: Creating dynamic parent/child relationships

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11105511]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2020-11-29 07:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?