mark up lazy_build as code
[gitmo/Moose.git] / lib / Moose.pm
index 88544bb..fd1ed02 100644 (file)
@@ -1,8 +1,10 @@
 package Moose;
+use strict;
+use warnings;
 
 use 5.008;
 
-our $VERSION   = '0.83';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
@@ -11,7 +13,7 @@ use Carp         'confess';
 
 use Moose::Exporter;
 
-use Class::MOP 0.87;
+use Class::MOP 0.89;
 
 use Moose::Meta::Class;
 use Moose::Meta::TypeConstraint;
@@ -32,13 +34,6 @@ use Moose::Meta::Role::Application::ToInstance;
 use Moose::Util::TypeConstraints;
 use Moose::Util ();
 
-sub _caller_info {
-    my $level = @_ ? ($_[0] + 1) : 2;
-    my %info;
-    @info{qw(package file line)} = caller($level);
-    return \%info;
-}
-
 sub throw_error {
     # FIXME This
     shift;
@@ -68,7 +63,7 @@ sub has {
     Moose->throw_error('Usage: has \'name\' => ( key => value, ... )')
         if @_ % 2 == 1;
 
-    my %options = ( definition_context => _caller_info(), @_ );
+    my %options = ( definition_context => Moose::Util::_caller_info(), @_ );
     my $attrs = ( ref($name) eq 'ARRAY' ) ? $name : [ ($name) ];
     Class::MOP::Class->initialize($class)->add_attribute( $_, %options ) for @$attrs;
 }
@@ -469,7 +464,7 @@ B<NOTE:> Triggers will only fire when you B<assign> to the attribute,
 either in the constructor, or using the writer. Default and built values will
 B<not> cause the trigger to be fired.
 
-=item I<handles =E<gt> ARRAY | HASH | REGEXP | ROLE | CODE>
+=item I<handles =E<gt> ARRAY | HASH | REGEXP | ROLE | DUCKTYPE | CODE>
 
 The I<handles> option provides Moose classes with automated delegation features.
 This is a pretty complex and powerful option. It accepts many different option
@@ -561,6 +556,14 @@ methods of the role and any required methods of the role. It should be noted
 that this does B<not> include any method modifiers or generated attribute
 methods (which is consistent with role composition).
 
+=item C<DUCKTYPE>
+
+With the duck type option, you pass a duck type object whose "interface" then
+becomes the list of methods to handle. The "interface" can be defined as; the
+list of methods passed to C<duck_type> to create a duck type object. For more
+information on C<duck_type> please check
+L<Moose::Util::TypeConstraints>.
+
 =item C<CODE>
 
 This is the option to use when you really want to do something funky. You should
@@ -772,7 +775,7 @@ B<are not> overridden, or removed.
 
 =item B<around $name|@names =E<gt> sub { ... }>
 
-This three items are syntactic sugar for the before, after, and around method
+These three items are syntactic sugar for the before, after, and around method
 modifier features that L<Class::MOP> provides. More information on these may be
 found in the L<Class::MOP::Class documentation|Class::MOP::Class/"Method
 Modifiers"> for now.