Thursday, September 04, 2008

Learn Moose 1: subtype

finally I wrote my first Moose script.
mainly I want to write a MooseX::Schwartz if I have enough time.

Moose is very powerful.
I want a common function like set a flag to debug, besides that, we can define debug logger sub ourself.
something like:
->verbose(1);
->verbose(0);
->verbose( sub {
my $msg = shift;
$msg =~ s/\s+$//;
print STDERR "[CUS] $msg\n";
} );
# then call ->debug depends on ->verbose.

final code is here:
http://fayland.googlecode.com/svn/trunk/script/learn_moose/007_subtype.pl

I'm not a Moose guru, but Moose sounds pretty exciting!

Labels:

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home