Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re^2: Inheritable configuration options.... but with default values?by LanX (Saint) |
on Feb 20, 2020 at 23:06 UTC ( [id://11113287]=note: print w/replies, xml ) | Need Help?? |
I'm confused, in my book is new() reserved for object constructors not classes. Inheritance for classes should be easier done by
Please note that I couldn't make it work with SUPER, ( but I'm no SUPER expert anyway ;-)
( { a => 1, b => 2 }, { a => 11, b => 2, c => 33 }, { a => 11, b => 222, c => 33 }, ) Can't locate object method "cfg" via package "SUPER" (perhaps you forgot to load "SUPER"?) at d:/tmp/pm/class_cfg.pl line 32. Compilation exited abnormally with code 255 at Fri Feb 21 00:04:51
editah I misread perlobj > The SUPER modifier can only be used for method calls. You can't use it for regular subroutine calls or class methods:
updateThis works, albeit with ugly syntax.
{ a => 11, b => 2, c => 33, n => "2b" } Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|