![]() |
|
Perl: the Markov chain saw | |
PerlMonks |
Re: object oriented Perl advice / constructor creation in child classby kcott (Archbishop) |
on Jul 10, 2018 at 09:13 UTC ( #1218230=note: print w/replies, xml ) | Need Help?? |
G'day smarthacker67, While I assume you're just using "A", "B", etc. as examples, this generally isn't a good idea as you can run into name collisions; for instance, B.pm is a core module which you'll already have installed. I don't understand where "C1.pm" sits in your hierarchy. It seems to be both a file and directory which is a subdirectory of another file ("C.pm"). Obviously that can't be the case but I don't know what you want: "lib/C/C1.pm"?, "lib/C1.pm"?, something else? Here's some skeleton code to show how you might achieve this sort of thing with Moose. This is intended as an academic exercise: there's no suggestion that this is production-grade code; nor that Moose is the best choice for your specific application.
Update (typo fix): s{lib/C/C.pm}{lib/C/C1.pm} — Ken
In Section
Seekers of Perl Wisdom
|
|