Welcome to the Monastery | |
PerlMonks |
Re: Package Name and Inheritanceby erroneousBollock (Curate) |
on Nov 14, 2007 at 09:57 UTC ( [id://650712]=note: print w/replies, xml ) | Need Help?? |
The following is a fairly typical example of a simple constructor for the Stuff class:
If you bless the attribute hash into 'Stuff' rather than $class, a subclass of Stuff (say Junk) which calls the super-class's constructor will be blessed into the Stuff package instead of the Junk package. If Junk adds/overrides any methods, they won't be called. Another problem is that it's much harder to maintain a class if the classname is sprayed all over its constituent modules. -David
In Section
Seekers of Perl Wisdom
|
|