construction_string => (
$moo_constructor
? ($con ? $con->construction_string : undef)
- : ('$class->'.$target.'::SUPER::new(@_)')
+ : ('$class->'.$target.'::SUPER::new($class->can(q[FOREIGNBUILDARGS]) ? $class->FOREIGNBUILDARGS(@_) : @_)')
),
subconstructor_handler => (
' if ($Moo::MAKERS{$class}) {'."\n"
isa => sub {
die "Only SWEET-TREATZ supported!" unless $_[0] eq 'SWEET-TREATZ'
},
-);
+ );
has pounds => (
is => 'rw',
Declares an attribute for the class.
+ package Bar;
+ extends 'Foo'; # Foo has an 'attr' attribute
+
+ has '+attr' => (
+ default => sub { "blah" },
+ );
+
+Using the C<+> notation, it's possible to override an attribute.
+
The options for C<has> are as follows:
=over 2
un => 'one',
}
-=item * trigger
+=item * C<trigger>
Takes a coderef which will get called any time the attribute is set. This
-includes the constructor. Coderef will be invoked against the object with the
-new value as an argument.
+includes the constructor, but not default or built values. Coderef will be
+invoked against the object with the new value as an argument.
If you set this to just C<1>, it generates a trigger which calls the
C<_trigger_${attr_name}> method on C<$self>. This feature comes from
Users' IRC: #moose on irc.perl.org
+=for html <a href="http://chat.mibbit.com/#moose@irc.perl.org">(click for instant chatroom login)</a>
+
Development and contribution IRC: #web-simple on irc.perl.org
+=for html <a href="http://chat.mibbit.com/#web-simple@irc.perl.org">(click for instant chatroom login)</a>
+
+Bugtracker: L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Moo>
+
+Git repository: L<git://git.shadowcat.co.uk/gitmo/Moo.git>
+
+Git web access: L<http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo/Moo.git>
+
=head1 AUTHOR
mst - Matt S. Trout (cpan:MSTROUT) <mst@shadowcat.co.uk>
haarg - Graham Knop (cpan:HAARG) <haarg@cpan.org>
+mattp - Matt Phillips (cpan:MATTP) <mattp@cpan.org>
+
=head1 COPYRIGHT
Copyright (c) 2010-2011 the Moo L</AUTHOR> and L</CONTRIBUTORS>
=head1 LICENSE
This library is free software and may be distributed under the same terms
-as perl itself.
+as perl itself. See L<http://dev.perl.org/licenses/>.
=cut