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.
Why...? (Score:1)
rjbs has explained what went wrong, but I'm curious why you'd expect it to behave differently. The behaviour is exactly as documented in Moose's section on is => 'rw'|'ro'.
Re: (Score:2)
Sorry about that. I just hastily threw together an example. But what's the value of allowing me to declare an attribute without an accessor or mutator? I'm sure there's a reason. I just don't see it.
Re: (Score:1)
There are a few reasons I can imagine, and several I'm fairly sure I'm too afraid to consider. :-)
One reason would be because one wants to explicitly set the 'reader' and the 'writer'.
But that doesn't explain why there is no warning if there is no reader/writer assigned at all. But that could happen because one want to create those sometime during runtime. Wacky, but I can imagine a few motivations to
Re:Why...? (Score:1)
The answer to "why" is simply "because you didn't ask for it". DWIMery is good up until it gets in your way, then it's annoying and difficult to work around. Here is another example (along with perigrin's excellent one) on why you might not want an accessor.
Here the side-effectual trigger is used to set the value of bar. Sure, seems kind of esoteric, but it is a valid use case.
- Stevan
Reply to This
Parent