more useful options | |
PerlMonks |
Re^2: Your favorite objects NOT of the hashref phylum (array w/ consts)by nothingmuch (Priest) |
on Mar 26, 2006 at 11:28 UTC ( [id://539277]=note: print w/replies, xml ) | Need Help?? |
For compile time catching of typos in attrs when using hashes as the internal representation use the fields module.
In perl 5.8 it's based on pseudohashes, which are a bit like mapping strings into arrays, except they use hash syntax. But everyone knows that pseudohashes suck ;-) In perl 5.9 fields uses Hash::Util and locks the hash for runtime checks, and also performs the same compile time checks, so you get the benefits of fields without the insanity of pseudohashes. The way you use it is: But this still doesn't let you encapsulate the properties in subroutines that you can override.
-nuffin zz zZ Z Z #!perl
In Section
Seekers of Perl Wisdom
|
|