From: Jesse Luehrs Date: Tue, 2 Jun 2009 01:03:25 +0000 (-0500) Subject: actually do the merge X-Git-Tag: 0.18_01~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cf0d1310362a7607e8baf57dacd9e04843de0780;p=gitmo%2FMooseX-AttributeHelpers.git actually do the merge --- diff --git a/lib/MooseX/AttributeHelpers.pm b/lib/MooseX/AttributeHelpers.pm index 69331b0..918b15d 100644 --- a/lib/MooseX/AttributeHelpers.pm +++ b/lib/MooseX/AttributeHelpers.pm @@ -10,6 +10,7 @@ use Moose 0.56 (); use MooseX::AttributeHelpers::Meta::Method::Provided; use MooseX::AttributeHelpers::Meta::Method::Curried; +use MooseX::AttributeHelpers::Trait::Bool; use MooseX::AttributeHelpers::Trait::Counter; use MooseX::AttributeHelpers::Trait::Number; use MooseX::AttributeHelpers::Trait::String; diff --git a/lib/MooseX/AttributeHelpers/Counter.pm b/lib/MooseX/AttributeHelpers/Counter.pm index 9a2cea2..395c2c1 100644 --- a/lib/MooseX/AttributeHelpers/Counter.pm +++ b/lib/MooseX/AttributeHelpers/Counter.pm @@ -17,116 +17,3 @@ package # hide me from search.cpan.org sub register_implementation { 'MooseX::AttributeHelpers::Counter' } 1; - -__END__ - -=pod - -=head1 NAME - -MooseX::AttributeHelpers::Counter - -=head1 SYNOPSIS - - package MyHomePage; - use Moose; - use MooseX::AttributeHelpers; - - has 'counter' => ( - metaclass => 'Counter', - is => 'ro', - isa => 'Num', - default => sub { 0 }, - provides => { - inc => 'inc_counter', - dec => 'dec_counter', - reset => 'reset_counter', - } - ); - - my $page = MyHomePage->new(); - $page->inc_counter; # same as $page->counter($page->counter + 1); - $page->dec_counter; # same as $page->counter($page->counter - 1); - -=head1 DESCRIPTION - -This module provides a simple counter attribute, which can be -incremented and decremeneted. - -If your attribute definition does not include any of I, I, -I or I but does use the C metaclass, -then this module applies defaults as in the L -above. This allows for a very basic counter definition: - - has 'foo' => (metaclass => 'Counter'); - $obj->inc_foo; - -=head1 METHODS - -=over 4 - -=item B - -=item B - -=item B - -=item B - -=item B - -Run before its superclass method. - -=item B - -Run after its superclass method. - -=back - -=head1 PROVIDED METHODS - -It is important to note that all those methods do in place -modification of the value stored in the attribute. - -=over 4 - -=item I - -Set the counter to the specified value. - -=item I - -Increments the value stored in this slot by 1. Providing an argument will -cause the counter to be increased by specified amount. - -=item I - -Decrements the value stored in this slot by 1. Providing an argument will -cause the counter to be increased by specified amount. - -=item I - -Resets the value stored in this slot to it's default value. - -=back - -=head1 BUGS - -All complex software has bugs lurking in it, and this module is no -exception. If you find a bug please either email me, or add the bug -to cpan-RT. - -=head1 AUTHOR - -Stevan Little Estevan@iinteractive.comE - -=head1 COPYRIGHT AND LICENSE - -Copyright 2007-2008 by Infinity Interactive, Inc. - -L - -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself. - -=cut diff --git a/lib/MooseX/AttributeHelpers/Trait/Collection.pm b/lib/MooseX/AttributeHelpers/Trait/Collection.pm index 44c8081..c1de2fb 100644 --- a/lib/MooseX/AttributeHelpers/Trait/Collection.pm +++ b/lib/MooseX/AttributeHelpers/Trait/Collection.pm @@ -60,4 +60,3 @@ This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut - diff --git a/lib/MooseX/AttributeHelpers/Trait/Collection/Array.pm b/lib/MooseX/AttributeHelpers/Trait/Collection/Array.pm index d1c57e0..43688c7 100644 --- a/lib/MooseX/AttributeHelpers/Trait/Collection/Array.pm +++ b/lib/MooseX/AttributeHelpers/Trait/Collection/Array.pm @@ -2,7 +2,8 @@ package MooseX::AttributeHelpers::Trait::Collection::Array; use Moose::Role; -our $VERSION = '0.01'; +our $VERSION = '0.17'; +$VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; use MooseX::AttributeHelpers::MethodProvider::Array; @@ -95,4 +96,3 @@ This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut - diff --git a/lib/MooseX/AttributeHelpers/Trait/Collection/Bag.pm b/lib/MooseX/AttributeHelpers/Trait/Collection/Bag.pm index 96a7bbe..463ed55 100644 --- a/lib/MooseX/AttributeHelpers/Trait/Collection/Bag.pm +++ b/lib/MooseX/AttributeHelpers/Trait/Collection/Bag.pm @@ -3,7 +3,8 @@ package MooseX::AttributeHelpers::Trait::Collection::Bag; use Moose::Role; use Moose::Util::TypeConstraints; -our $VERSION = '0.01'; +our $VERSION = '0.17'; +$VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; use MooseX::AttributeHelpers::MethodProvider::Bag; @@ -113,4 +114,3 @@ This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut - diff --git a/lib/MooseX/AttributeHelpers/Trait/Collection/Hash.pm b/lib/MooseX/AttributeHelpers/Trait/Collection/Hash.pm index 73070d3..357e1fb 100644 --- a/lib/MooseX/AttributeHelpers/Trait/Collection/Hash.pm +++ b/lib/MooseX/AttributeHelpers/Trait/Collection/Hash.pm @@ -2,7 +2,8 @@ package MooseX::AttributeHelpers::Trait::Collection::Hash; use Moose::Role; -our $VERSION = '0.02'; +our $VERSION = '0.17'; +$VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; use MooseX::AttributeHelpers::MethodProvider::Hash; @@ -43,7 +44,7 @@ MooseX::AttributeHelpers::Collection::Hash package Stuff; use Moose; use MooseX::AttributeHelpers; - + has 'options' => ( metaclass => 'Collection::Hash', is => 'ro', @@ -51,16 +52,16 @@ MooseX::AttributeHelpers::Collection::Hash default => sub { {} }, provides => { 'set' => 'set_option', - 'get' => 'get_option', + 'get' => 'get_option', 'empty' => 'has_options', 'count' => 'num_options', 'delete' => 'delete_option', } ); - + =head1 DESCRIPTION -This module provides an Hash attribute which provides a number of +This module provides a Hash attribute which provides a number of hash-like operations. See L for more details. @@ -80,7 +81,7 @@ for more details. =head1 BUGS -All complex software has bugs lurking in it, and this module is no +All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to cpan-RT. @@ -98,4 +99,3 @@ This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut - diff --git a/lib/MooseX/AttributeHelpers/Trait/Collection/ImmutableHash.pm b/lib/MooseX/AttributeHelpers/Trait/Collection/ImmutableHash.pm index b963404..4727dff 100644 --- a/lib/MooseX/AttributeHelpers/Trait/Collection/ImmutableHash.pm +++ b/lib/MooseX/AttributeHelpers/Trait/Collection/ImmutableHash.pm @@ -2,7 +2,8 @@ package MooseX::AttributeHelpers::Trait::Collection::ImmutableHash; use Moose::Role; -our $VERSION = '0.01'; +our $VERSION = '0.17'; +$VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; use MooseX::AttributeHelpers::MethodProvider::ImmutableHash; @@ -96,4 +97,3 @@ This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut - diff --git a/lib/MooseX/AttributeHelpers/Trait/Collection/List.pm b/lib/MooseX/AttributeHelpers/Trait/Collection/List.pm index a62bf5d..bd677e8 100644 --- a/lib/MooseX/AttributeHelpers/Trait/Collection/List.pm +++ b/lib/MooseX/AttributeHelpers/Trait/Collection/List.pm @@ -2,7 +2,8 @@ package MooseX::AttributeHelpers::Trait::Collection::List; use Moose::Role; -our $VERSION = '0.01'; +our $VERSION = '0.17'; +$VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; use MooseX::AttributeHelpers::MethodProvider::List; @@ -51,7 +52,7 @@ MooseX::AttributeHelpers::Collection::List default => sub { [] }, provides => { map => 'map_options', - grep => 'fitler_options', + grep => 'filter_options', } ); @@ -95,4 +96,3 @@ This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut - diff --git a/lib/MooseX/AttributeHelpers/Trait/Counter.pm b/lib/MooseX/AttributeHelpers/Trait/Counter.pm index d402f13..70a5c0b 100644 --- a/lib/MooseX/AttributeHelpers/Trait/Counter.pm +++ b/lib/MooseX/AttributeHelpers/Trait/Counter.pm @@ -2,14 +2,14 @@ package MooseX::AttributeHelpers::Trait::Counter; use Moose::Role; -with 'MooseX::AttributeHelpers::Trait::Base' - => { excludes => ['method_provider'] }; - -our $VERSION = '0.03'; +our $VERSION = '0.17'; +$VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; use MooseX::AttributeHelpers::MethodProvider::Counter; +with 'MooseX::AttributeHelpers::Trait::Base'; + has 'method_provider' => ( is => 'ro', isa => 'ClassName', @@ -54,3 +54,115 @@ sub register_implementation { 'MooseX::AttributeHelpers::Trait::Counter' } 1; +__END__ + +=pod + +=head1 NAME + +MooseX::AttributeHelpers::Counter + +=head1 SYNOPSIS + + package MyHomePage; + use Moose; + use MooseX::AttributeHelpers; + + has 'counter' => ( + metaclass => 'Counter', + is => 'ro', + isa => 'Num', + default => sub { 0 }, + provides => { + inc => 'inc_counter', + dec => 'dec_counter', + reset => 'reset_counter', + } + ); + + my $page = MyHomePage->new(); + $page->inc_counter; # same as $page->counter($page->counter + 1); + $page->dec_counter; # same as $page->counter($page->counter - 1); + +=head1 DESCRIPTION + +This module provides a simple counter attribute, which can be +incremented and decremeneted. + +If your attribute definition does not include any of I, I, +I or I but does use the C metaclass, +then this module applies defaults as in the L +above. This allows for a very basic counter definition: + + has 'foo' => (metaclass => 'Counter'); + $obj->inc_foo; + +=head1 METHODS + +=over 4 + +=item B + +=item B + +=item B + +=item B + +=item B + +Run before its superclass method. + +=item B + +Run after its superclass method. + +=back + +=head1 PROVIDED METHODS + +It is important to note that all those methods do in place +modification of the value stored in the attribute. + +=over 4 + +=item I + +Set the counter to the specified value. + +=item I + +Increments the value stored in this slot by 1. Providing an argument will +cause the counter to be increased by specified amount. + +=item I + +Decrements the value stored in this slot by 1. Providing an argument will +cause the counter to be increased by specified amount. + +=item I + +Resets the value stored in this slot to it's default value. + +=back + +=head1 BUGS + +All complex software has bugs lurking in it, and this module is no +exception. If you find a bug please either email me, or add the bug +to cpan-RT. + +=head1 AUTHOR + +Stevan Little Estevan@iinteractive.comE + +=head1 COPYRIGHT AND LICENSE + +Copyright 2007-2008 by Infinity Interactive, Inc. + +L + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut diff --git a/lib/MooseX/AttributeHelpers/Trait/Number.pm b/lib/MooseX/AttributeHelpers/Trait/Number.pm index 85bd6fd..d4fc024 100644 --- a/lib/MooseX/AttributeHelpers/Trait/Number.pm +++ b/lib/MooseX/AttributeHelpers/Trait/Number.pm @@ -1,7 +1,8 @@ package MooseX::AttributeHelpers::Trait::Number; use Moose::Role; -our $VERSION = '0.02'; +our $VERSION = '0.17'; +$VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; with 'MooseX::AttributeHelpers::Trait::Base'; @@ -167,4 +168,3 @@ This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut - diff --git a/lib/MooseX/AttributeHelpers/Trait/String.pm b/lib/MooseX/AttributeHelpers/Trait/String.pm index b48aec2..b4f8e14 100644 --- a/lib/MooseX/AttributeHelpers/Trait/String.pm +++ b/lib/MooseX/AttributeHelpers/Trait/String.pm @@ -2,7 +2,8 @@ package MooseX::AttributeHelpers::Trait::String; use Moose::Role; -our $VERSION = '0.01'; +our $VERSION = '0.17'; +$VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; use MooseX::AttributeHelpers::MethodProvider::String; @@ -184,4 +185,3 @@ This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut -