Think about Loose Coupling | |
PerlMonks |
Re: my Dog $spot;by Zaxo (Archbishop) |
on Jun 08, 2006 at 05:10 UTC ( [id://554216]=note: print w/replies, xml ) | Need Help?? |
Here's a Dog class which admits dynamic strong typing/value types, like I suggested in my replies to xdg and TimToady. Which prints, Only tangible Dogs bark, Can't call method "bark" on an undefined value at dog.pl line 42. Declared attributes would likely be stored in %{tied($spot)}, which is persistent and independent of whatever is assigned the name. Matching declared attributes with Dog instance ones could be part of the constraint. This is a very rough proof of concept. I haven't tried to make my $spot : Watchful = Dog->new; do the right thing. I haven't checked if it plays nice with fields.pm or Attribute::Handlers. I'd be surprised if it did at this stage. After Compline,
In Section
Meditations
|
|