NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
accessors (Score:1)
This is the reason I am leaning more and more towards Class::Accessor and similiar. I note that you'd have to override set() to return $self that way, however.
-Dom
Re:accessors (Score:2)
I usually write something like
which gives you the ability to set something to undef but doesn't let you chain method calls. If you wanted to chain method calls, you could instead write it this way
Now I'm just being silly... (Score:2)
Well, it looks like I'm on the way to re-inventing Class::Accessors now. I just looked at that module, and it seems to do the same sort of thing, but much nicer. It goes another step and lets you just specify the names of the accessors, and it creates the subs and stuffs them in your namespace for you. Since it knows the names of the subs when it creates them, it can avoid that repeated callerIt's also much more configurable.
At least it was a fun excersize
-matt
Reply to This
Parent