From: Stevan Little Date: Sat, 10 Jun 2006 00:32:04 +0000 (+0000) Subject: more-docs X-Git-Tag: 0_02~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5272f13f684d461d95aa45de22d8776a98c03c64;p=gitmo%2FMoose-Autobox.git more-docs --- diff --git a/lib/Moose/Autobox.pm b/lib/Moose/Autobox.pm index a36c1f5..6940fac 100644 --- a/lib/Moose/Autobox.pm +++ b/lib/Moose/Autobox.pm @@ -17,7 +17,7 @@ package SCALAR; # this doesnt make sense, but # I need to prevent Moose from # assiging to @ISA -use base 'Moose::Autobox'; +use base 'UNIVERSAL'; use Moose; with 'Moose::Autobox::Scalar'; @@ -25,21 +25,21 @@ with 'Moose::Autobox::Scalar'; *does = \&Moose::Object::does; package ARRAY; -use base 'Moose::Autobox'; +use base 'UNIVERSAL'; use Moose; with 'Moose::Autobox::Array'; *does = \&Moose::Object::does; package HASH; -use base 'Moose::Autobox'; +use base 'UNIVERSAL'; use Moose; with 'Moose::Autobox::Hash'; *does = \&Moose::Object::does; package CODE; -use base 'Moose::Autobox'; +use base 'UNIVERSAL'; use Moose; with 'Moose::Autobox::Code'; diff --git a/lib/Moose/Autobox/Array.pm b/lib/Moose/Autobox/Array.pm index 38e94f1..97ac19a 100644 --- a/lib/Moose/Autobox/Array.pm +++ b/lib/Moose/Autobox/Array.pm @@ -126,7 +126,13 @@ Moose::Autobox::Array - the Array role use Moose::Autobox; use autobox; + [ 1..5 ]->isa('ARRAY'); # true + [ a..z ]->does('Moose::Autobox::Array'); # true + [ 0..2 ]->does('Moose::Autobox::List'); # true + print "Squares: " . [ 1 .. 10 ]->map(sub { $_ * $_ })->join(', '); + + print [ 1, 'number' ]->sprintf('%d is the loneliest %s'); =head1 DESCRIPTION @@ -136,41 +142,39 @@ This is a role to describe operations on the Array type. =over 4 -=item B - =item B -=item B +=item B =item B -=item B +=item B -=item B +=item B -=item B +=item B =back -=head2 Moose::Autobox::Indexed implementation +=head2 Indexed implementation =over 4 -=item B +=item B -=item B +=item B -=item B +=item B =item B -=item B - =item B +=item B + =back -=head2 Moose::Autobox::List implementation +=head2 List implementation =over 4 @@ -178,17 +182,23 @@ This is a role to describe operations on the Array type. =item B -=item B +=item B =item B -=item B +=item B -=item B +=item B =item B -=item B +=item B + +=back + +=over 4 + +=item B =back diff --git a/lib/Moose/Autobox/Code.pm b/lib/Moose/Autobox/Code.pm index 80ecbe1..5101466 100644 --- a/lib/Moose/Autobox/Code.pm +++ b/lib/Moose/Autobox/Code.pm @@ -48,8 +48,7 @@ Moose::Autobox::Code - the Code role use autobox; my $adder = sub { $_[0] + $_[1] }; - - $add_2 = $adder->curry(2); + my $add_2 = $adder->curry(2); $add_2->(2); # returns 4 @@ -61,17 +60,24 @@ This is a role to describe operations on the Code type. =over 4 -=item B +=item B + +=item B + +=item B -=item B +=item B -=item B +=item B -=item B +This will take a list of C<@subs> and compose them all into a single +subroutine where the output of one sub will be the input of another. -=item B +=back + +=over 4 -=item B +=item B =back diff --git a/lib/Moose/Autobox/Defined.pm b/lib/Moose/Autobox/Defined.pm index 3fb2820..372193f 100644 --- a/lib/Moose/Autobox/Defined.pm +++ b/lib/Moose/Autobox/Defined.pm @@ -21,6 +21,12 @@ Moose::Autobox::Defined - the Defined role use Moose::Autobox; use autobox; + + my $x; + $x->defined; # false + + $x = 10; + $x->defined; # true =head1 DESCRIPTION @@ -30,12 +36,16 @@ This is a role to describes a defined value. =over 4 -=item B - =item B =back +=over 4 + +=item B + +=back + =head1 BUGS All complex software has bugs lurking in it, and this module is no diff --git a/lib/Moose/Autobox/Hash.pm b/lib/Moose/Autobox/Hash.pm index 5c318dc..c4e54eb 100644 --- a/lib/Moose/Autobox/Hash.pm +++ b/lib/Moose/Autobox/Hash.pm @@ -68,13 +68,11 @@ This is a role to describes a Hash value. =over 4 -=item B - =item B =back -=head2 Moose::Autobox::Indexed implementation +=head2 Indexed implementation =over 4 @@ -92,6 +90,12 @@ This is a role to describes a Hash value. =back +=over 4 + +=item B + +=back + =head1 BUGS All complex software has bugs lurking in it, and this module is no diff --git a/lib/Moose/Autobox/Indexed.pm b/lib/Moose/Autobox/Indexed.pm index 6c3a2de..3380993 100644 --- a/lib/Moose/Autobox/Indexed.pm +++ b/lib/Moose/Autobox/Indexed.pm @@ -22,11 +22,6 @@ __END__ Moose::Autobox::Indexed - the Indexed role -=head1 SYNOPOSIS - - use Moose::Autobox; - use autobox; - =head1 DESCRIPTION This is a role to describes an collection whose values can be diff --git a/lib/Moose/Autobox/Item.pm b/lib/Moose/Autobox/Item.pm index a80b9d2..08a6c61 100644 --- a/lib/Moose/Autobox/Item.pm +++ b/lib/Moose/Autobox/Item.pm @@ -15,11 +15,6 @@ __END__ Moose::Autobox::Item - the Item role -=head1 SYNOPOSIS - - use Moose::Autobox; - use autobox; - =head1 DESCRIPTION This is the root of our role hierarchy. diff --git a/lib/Moose/Autobox/List.pm b/lib/Moose/Autobox/List.pm index 434b0f9..1aabd28 100644 --- a/lib/Moose/Autobox/List.pm +++ b/lib/Moose/Autobox/List.pm @@ -47,11 +47,6 @@ __END__ Moose::Autobox::List - the List role -=head1 SYNOPOSIS - - use Moose::Autobox; - use autobox; - =head1 DESCRIPTION This is a role to describes a List interface. This is not @@ -63,14 +58,18 @@ L implements this. =over 4 -=item B - =item B =item B =back +=over 4 + +=item B + +=back + =head1 REQUIRED METHODS =over 4 diff --git a/lib/Moose/Autobox/Number.pm b/lib/Moose/Autobox/Number.pm index 9f42445..7ee9586 100644 --- a/lib/Moose/Autobox/Number.pm +++ b/lib/Moose/Autobox/Number.pm @@ -15,11 +15,6 @@ __END__ Moose::Autobox::Number - the Number role -=head1 SYNOPOSIS - - use Moose::Autobox; - use autobox; - =head1 DESCRIPTION This is a role to describes a Numeric value. diff --git a/lib/Moose/Autobox/Ref.pm b/lib/Moose/Autobox/Ref.pm index 7d83e88..a524612 100644 --- a/lib/Moose/Autobox/Ref.pm +++ b/lib/Moose/Autobox/Ref.pm @@ -15,11 +15,6 @@ __END__ Moose::Autobox::Ref - the Ref role -=head1 SYNOPOSIS - - use Moose::Autobox; - use autobox; - =head1 DESCRIPTION This is a role to describes a reference value. diff --git a/lib/Moose/Autobox/Scalar.pm b/lib/Moose/Autobox/Scalar.pm index ea035d1..7f358eb 100644 --- a/lib/Moose/Autobox/Scalar.pm +++ b/lib/Moose/Autobox/Scalar.pm @@ -16,11 +16,6 @@ __END__ Moose::Autobox::Scalar - the Scalar role -=head1 SYNOPOSIS - - use Moose::Autobox; - use autobox; - =head1 DESCRIPTION This is a role to describes a Scalar value, which is defined diff --git a/lib/Moose/Autobox/String.pm b/lib/Moose/Autobox/String.pm index bf048a2..9ddda09 100644 --- a/lib/Moose/Autobox/String.pm +++ b/lib/Moose/Autobox/String.pm @@ -45,8 +45,6 @@ This is a role to describes a String value. =over 4 -=item B - =item B =item B @@ -67,6 +65,12 @@ This is a role to describes a String value. =back +=over 4 + +=item B + +=back + =head1 BUGS All complex software has bugs lurking in it, and this module is no diff --git a/lib/Moose/Autobox/Undef.pm b/lib/Moose/Autobox/Undef.pm index 3d2b7d3..0d7fbdc 100644 --- a/lib/Moose/Autobox/Undef.pm +++ b/lib/Moose/Autobox/Undef.pm @@ -20,7 +20,10 @@ Moose::Autobox::Undef - the Undef role =head1 SYNOPOSIS use Moose::Autobox; - use autobox; + use autobox UNDEF => 'Moose::Autobox::Undef'; + + my $x; + $x->defined; # false =head1 DESCRIPTION @@ -30,12 +33,16 @@ This is a role to describes a undefined value. =over 4 -=item B - =item B =back +=over 4 + +=item B + +=back + =head1 BUGS All complex software has bugs lurking in it, and this module is no diff --git a/lib/Moose/Autobox/Value.pm b/lib/Moose/Autobox/Value.pm index d41d73d..de5a0aa 100644 --- a/lib/Moose/Autobox/Value.pm +++ b/lib/Moose/Autobox/Value.pm @@ -1,5 +1,5 @@ package Moose::Autobox::Value; -use Moose::Role 'with', 'requires'; +use Moose::Role 'with'; our $VERSION = '0.01';