Learning Moose - I

Started to look to Moose today. Better later than never. But I never liked OO programming, and Perl core OO was enough for me. So, I am kind of forcing me to do it.

To start with, I am rereading a presentation from Yuval on Portuguese Perl Workshop 2008. I know probably things changed, and so, probably there is a better syntax handling.

At the moment I did not like the way object properties (or variables) are initialized with an array reference:

default => sub { [qw(Bob Alice Tim)] },

I really would prefer it without the sub. Not sure (yet) if if it required or not, but I will find out very soon...

...ahs! Got it, I think. If no sub were supplied, all the objects would get the same reference to the same array. Therefore, the lazy option, and the anonymous function. Well, couldn't that be solved with Clone?

1 Comment

Alberto, using Clone is an interesting idea.

If you want to take a stab at implementing that, just us at irc://irc.perl.org/#moose (or #moose-dev).

Leave a comment

About Alberto Simões

user-pic I blog about Perl. D'uh!