use B 'perlstring';
use Sub::Defer ();
-our $VERSION = '1.000006'; # 1.0.6
+our $VERSION = '1.000008'; # 1.0.8
$VERSION = eval $VERSION;
require Moo::sification;
if ($Moo::Role::INFO{$target} and $Moo::Role::INFO{$target}{is_role}) {
die "Cannot import Moo into a role";
}
- return if $MAKERS{$target}; # already exported into this package
- $MAKERS{$target} = { is_class => 1 };
+ $MAKERS{$target} ||= {};
_install_tracked $target => extends => sub {
$class->_set_superclasses($target, @_);
$class->_maybe_reset_handlemoose($target);
return;
};
}
+ return if $MAKERS{$target}{is_class}; # already exported into this package
+ $MAKERS{$target}{is_class} = 1;
{
no strict 'refs';
@{"${target}::ISA"} = do {
no warnings 'once'; # piss off. -- mst
$Moo::HandleMoose::MOUSE{$target} = [
grep defined, map Mouse::Util::find_meta($_), @_
- ] if $INC{"Mouse.pm"};
+ ] if Mouse::Util->can('find_meta');
}
sub _maybe_reset_handlemoose {
C<builder> to C<_build_${attribute_name}> to allow on-demand generated
attributes. This feature was my attempt to fix my incompetence when
originally designing C<lazy_build>, and is also implemented by
-L<MooseX::AttributeShortcuts>.
+L<MooseX::AttributeShortcuts>. There is, however, nothing to stop you
+using C<lazy> and C<builder> yourself with C<rwp> or C<rw> - it's just that
+this isn't generally a good idea so we don't provide a shortcut for it.
C<rwp> generates a reader like C<ro>, but also sets C<writer> to
C<_set_${attribute_name}> for attributes that are designed to be written
$self->$builder;
-If you set this to just C<1>, the predicate is automatically named
-C<_build_${attr_name}>. This feature comes from L<MooseX::AttributeShortcuts>.
+The following features come from L<MooseX::AttributeShortcuts>:
+
+If you set this to just C<1>, the builder is automatically named
+C<_build_${attr_name}>.
+
+If you set this to a coderef or code-convertible object, that variable will be
+installed under C<$class::_build_${attr_name}> and the builder set to the same
+name.
=item * C<clearer>
constructor. Moo does it automatically the first time ->new is called
on your class.
+An extension L<MooX::late> exists to ease translating Moose packages
+to Moo by providing a more Moose-like interface.
+
=head1 SUPPORT
Users' IRC: #moose on irc.perl.org
tobyink - Toby Inkster (cpan:TOBYINK) <tobyink@cpan.org>
+haarg - Graham Knop (cpan:HAARG) <haarg@cpan.org>
+
=head1 COPYRIGHT
Copyright (c) 2010-2011 the Moo L</AUTHOR> and L</CONTRIBUTORS>