There's more than one way to do things | |
PerlMonks |
Re^2: Inheritance when subclass passed as a parameterby davies (Prior) |
on Feb 05, 2020 at 11:09 UTC ( [id://11112423]=note: print w/replies, xml ) | Need Help?? |
Thanks a lot. I'm pretty sure that a factory method is what I need. I've never used them before, so I have some googling to do. Are there any especially good (or bad) docs? I am certainly confused (which is why I'm coming here for help) and the fog is starting to lift thanks to everyone's help. My problem with Service::XML->new is that I really need to call it as Service::$var->new, as I don't know which service will be used until I get the data. I tried various forms of that and got various syntax errors. Obviously I will have to do lots of error checking in case a service is requested that has no subclass, but I'm trying to get the basics working first. Which I won't if I make trivial blunders like the character class Choroba pointed out. Regards, John Davies Update: https://www.perl.com/pub/2003/08/15/design3.html/ looks helpful to me, although I think there are some more modern constructs I could use.
In Section
Seekers of Perl Wisdom
|
|