X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoo.pm;h=00aa4ed7ec3e621fe86f988057a3dbdfe9be3eb5;hb=6067158cf3146f758b7975688b2ac124f2992a34;hp=3af5e7ca976dc526f9545552c79d0aee657c89ad;hpb=3d49ee2792c487353cae59f59cde2e5aaba6d545;p=gitmo%2FMoo.git diff --git a/lib/Moo.pm b/lib/Moo.pm index 3af5e7c..00aa4ed 100644 --- a/lib/Moo.pm +++ b/lib/Moo.pm @@ -5,7 +5,7 @@ use Moo::_Utils; use B 'perlstring'; use Sub::Defer (); -our $VERSION = '0.091004'; # 0.91.4 +our $VERSION = '0.091007'; # 0.91.7 $VERSION = eval $VERSION; require Moo::sification; @@ -34,7 +34,7 @@ sub import { }; _install_coderef "${target}::with" => "Moo::with" => sub { require Moo::Role; - Moo::Role->apply_roles_to_package($target, $_[0]); + Moo::Role->apply_roles_to_package($target, @_); $class->_maybe_reset_handlemoose($target); }; $MAKERS{$target} = {}; @@ -351,14 +351,11 @@ The options for C are as follows: =item * is -B, may be C, C, C or C. +B, may be C, C, C or C. C generates an accessor that dies if you attempt to write to it - i.e. a getter only - by defaulting C to the name of the attribute. -C generates a normal getter/setter by defaulting C to the -name of the attribute. - C generates a reader like C, but also sets C to 1 and C to C<_build_${attribute_name}> to allow on-demand generated attributes. This feature was my attempt to fix my incompetence when @@ -370,6 +367,9 @@ C<_set_${attribute_name}> for attributes that are designed to be written from inside of the class, but read-only from outside. This feature comes from L. +C generates a normal getter/setter by defaulting C to the +name of the attribute. + =item * isa Takes a coderef which is meant to validate the attribute. Unlike L Moo @@ -588,9 +588,21 @@ provide a metaprotocol. However, if you load L, then will return an appropriate metaclass pre-populated by L. -No support for C, C, C, or C - override can -be handled by around albeit with a little more typing, and the author considers -augment to be a bad idea. +No support for C, C, C, or C - the author +considers augment to be a bad idea, and override can be translated: + + override foo => sub { + ... + super(); + ... + }; + + around foo => sub { + my ($orig, $self) = (shift, shift); + ... + $self->$orig(@_); + ... + }; The C method is not provided by default. The author suggests loading L into C (via C for example) and