Sure! I've omitted the _fetch routines here, because they're not particularly relevant to the Moose portions of the code, and the size would be a bit unmanageable.
| [reply] [d/l] [select] |
Very nice, I am glad you are enjoying Moose :)
Just one suggestion, if your "default" subs get large, it is usualy a good idea to convert them to 'builder' methods instead. You can find this feature documented in Class::MOP::Attribute. This:
has 'foo' => (
builder => 'build_foo'
);
is basically a shortcut for:
has 'foo' => (
default => sub { (shift)->build_foo }
);
It also gives the added benefit that any subclasses can easily override 'build_foo' themselves to get additional behavior.
| [reply] [d/l] [select] |
Just one suggestion, if your "default" subs get large, it is usualy a good idea to convert them to 'builder' methods instead.
Oh, very cool. I'd missed the builder bits while reading the docs. It does seem like a nice shortcut, and I kind of like the additional semantic alignment. I'm actually building the value, not setting a default value. Granted, it doesn't make a practical difference. But when there're two ways to do something, and one of them is a better semantic match, I usually choose that one.
| [reply] [d/l] |
Does it play well with lazy?
| [reply] |
You are my new hero.
I was at the to.pm meeting last night and I asked "has anyone used Moose?" The answer was no but talexb suggest I post to perlmonks to see if anyone knew of some real-world examples on CPAN. So here I am and here this is ready and waiting for me!
I admit, I don't quite grok it despite looking at merlyn's articles on the subject. But something keeps telling me "this is good stuff, you should learn it".
Methinks you are a little psychic. My thanks.
--
meraxes
-- A Møøse once bit my sister
| [reply] |
... suggest I post to perlmonks to see if anyone knew of some real-world examples on CPAN ...
Well, this is far from a comprehensive listing, these are just modules I know about (or wrote). Of course there is also a lot of Moose code not on CPAN that has been written for people's jobs (we have at least 5 apps in prod at my $work).
Some of my Moose related modules ...
... and modules written by others
You might always want to look in the MooseX:: namespace for the various extensions for Moose that have been written. And since Moose is meta-circular, most of these extensions to Moose have themselves been written with Moose.
| [reply] |