"be consistent" | |
PerlMonks |
Re^3: How Are Attributes Useful?by xdg (Monsignor) |
on Jan 19, 2005 at 05:03 UTC ( [id://423270]=note: print w/replies, xml ) | Need Help?? |
Look at Attribute::Protected and Attribute::Property. More specifically, look at their source to see what they're doing. Essentially, both are inserting some extra code that runs (fairly transparently) in advance of the code block you provided with the subroutine definition. There are legitimate issues around when attributes get run (i.e. during the CHECK phase by default) and whether this is mod_perl safe, but this can be coded around as some others have mentioned. Personally, I think they're an interesting concept that hasn't matured properly yet. Essentially, it's an attempt at specifying behavior as a bunch of building blocks -- another way of templating functionality and reducing redundant code. -xdg Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
In Section
Seekers of Perl Wisdom
|
|