From: Stevan Little Date: Mon, 13 Aug 2007 20:32:26 +0000 (+0000) Subject: 0.01 X-Git-Tag: 0.18_01~66 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5431dff2bf81c8286d40150d9f87a42a2a3e994c;p=gitmo%2FMooseX-AttributeHelpers.git 0.01 --- diff --git a/Build.PL b/Build.PL index da4ff14..f595d06 100644 --- a/Build.PL +++ b/Build.PL @@ -6,7 +6,7 @@ my $build = Module::Build->new( module_name => 'MooseX::AttributeHelpers', license => 'perl', requires => { - 'Moose' => '0.21', + 'Moose' => '0.24', }, optional => { }, diff --git a/ChangeLog b/ChangeLog index 985e931..d83a1a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ Revision history for Perl extension MooseX-AttributeHelpers -0.01 +0.01 Mon. Aug. 13, 2007 - module released to CPAN \ No newline at end of file diff --git a/MANIFEST b/MANIFEST index e69de29..ee00ed3 100644 --- a/MANIFEST +++ b/MANIFEST @@ -0,0 +1,27 @@ +Build.PL +ChangeLog +META.yml +Makefile.PL +MANIFEST +MANIFEST.SKIP +README +lib/MooseX/AttributeHelpers.pm +lib/MooseX/AttributeHelpers/Base.pm +lib/MooseX/AttributeHelpers/Collection.pm +lib/MooseX/AttributeHelpers/Counter.pm +lib/MooseX/AttributeHelpers/Number.pm +lib/MooseX/AttributeHelpers/Collection/Array.pm +lib/MooseX/AttributeHelpers/Collection/Hash.pm +lib/MooseX/AttributeHelpers/Meta/Method/Provided.pm +lib/MooseX/AttributeHelpers/MethodProvider/Array.pm +lib/MooseX/AttributeHelpers/MethodProvider/Counter.pm +lib/MooseX/AttributeHelpers/MethodProvider/Hash.pm +t/000_load.t +t/001_basic_counter.t +t/002_basic_array.t +t/003_basic_hash.t +t/004_basic_number.t +t/010_array_from_role.t +t/100_collection_with_roles.t +t/pod.t +t/pod_coverage.t diff --git a/lib/MooseX/AttributeHelpers.pm b/lib/MooseX/AttributeHelpers.pm index ad9e9be..3fe261b 100644 --- a/lib/MooseX/AttributeHelpers.pm +++ b/lib/MooseX/AttributeHelpers.pm @@ -25,11 +25,12 @@ MooseX::AttributeHelpers - Extend your attribute interfaces package MyClass; use Moose; + use MooseX::AttributeHelpers; - has mapping => ( + has 'mapping' => ( metaclass => 'Collection::Hash', is => 'rw', - isa => 'HashRef', + isa => 'HashRef[Str]', default => sub { {} }, provides => { exists => 'exists_in_mapping', @@ -81,6 +82,21 @@ Common methods for array references. =back +=head1 CAVEAT + +This is an early release of this module. Right now it is in great need +of documentation and tests in the test suite. However, we have used this +module to great success at $work where it has been tested very thoroughly +and deployed into a major production site. + +I plan on getting better docs and tests in the next few releases, but until +then please refer to the few tests we do have and feel free email and/or +message me on irc.perl.org if you have any questions. + +=head1 TODO + +We need tests and docs badly. + =head1 BUGS All complex software has bugs lurking in it, and this module is no @@ -91,6 +107,14 @@ to cpan-RT. Stevan Little Estevan@iinteractive.comE +B + +Robert (rlb3) Boone + +Chris (perigrin) Prather + +Robert (phaylon) Sedlacek + =head1 COPYRIGHT AND LICENSE Copyright 2007 by Infinity Interactive, Inc. diff --git a/lib/MooseX/AttributeHelpers/Base.pm b/lib/MooseX/AttributeHelpers/Base.pm index 921ff16..77631ee 100644 --- a/lib/MooseX/AttributeHelpers/Base.pm +++ b/lib/MooseX/AttributeHelpers/Base.pm @@ -135,35 +135,57 @@ __END__ =head1 NAME -MooseX::AttributeHelpers::Base - -=head1 SYNOPSIS +MooseX::AttributeHelpers::Base - Base class for attribute helpers =head1 DESCRIPTION -Base class for attribute helpers. +Documentation to come. =head1 ATTRIBUTES -=head2 provides +=over 4 + +=item B -=head2 method_provider +=item B -=head2 method_constructors +=item B + +=back =head1 EXTENDED ATTRIBUTES -=head2 $!default +=over 4 + +=item B<$!default> C<$!default> is now required. -=head2 type_constraint +=item B C is now required. +=back + =head1 METHODS -=head2 helper_type +=over 4 + +=item B + +=item B + +=item B + +=item B + +=item B + +=item B + +=item B + +=back =head1 BUGS diff --git a/lib/MooseX/AttributeHelpers/Collection.pm b/lib/MooseX/AttributeHelpers/Collection.pm index e277a01..38af3bd 100644 --- a/lib/MooseX/AttributeHelpers/Collection.pm +++ b/lib/MooseX/AttributeHelpers/Collection.pm @@ -77,12 +77,26 @@ __END__ =head1 NAME -=head1 SYNOPSIS +MooseX::AttributeHelpers::Collection - Base class for all collection type helpers =head1 DESCRIPTION +Documentation to come. + =head1 METHODS +=over 4 + +=item B + +=item B + +=item B + +=item B + +=back + =head1 BUGS All complex software has bugs lurking in it, and this module is no diff --git a/lib/MooseX/AttributeHelpers/Collection/Array.pm b/lib/MooseX/AttributeHelpers/Collection/Array.pm index 4bf17ca..48e6cec 100644 --- a/lib/MooseX/AttributeHelpers/Collection/Array.pm +++ b/lib/MooseX/AttributeHelpers/Collection/Array.pm @@ -1,7 +1,6 @@ package MooseX::AttributeHelpers::Collection::Array; use Moose; -use Moose::Util::TypeConstraints; our $VERSION = '0.01'; our $AUTHORITY = 'cpan:STEVAN'; @@ -31,10 +30,13 @@ __END__ =head1 NAME +MooseX::AttributeHelpers::Collection::Array + =head1 SYNOPSIS package Stuff; use Moose; + use MooseX::AttributeHelpers; has 'options' => ( metaclass => 'Collection', @@ -49,8 +51,22 @@ __END__ =head1 DESCRIPTION +This module provides an Array attribute which provides a number of +array operations. See L +for more details. + =head1 METHODS +=over 4 + +=item B + +=item B + +=item B + +=back + =head1 BUGS All complex software has bugs lurking in it, and this module is no diff --git a/lib/MooseX/AttributeHelpers/Collection/Hash.pm b/lib/MooseX/AttributeHelpers/Collection/Hash.pm index 01c5e50..b23130d 100644 --- a/lib/MooseX/AttributeHelpers/Collection/Hash.pm +++ b/lib/MooseX/AttributeHelpers/Collection/Hash.pm @@ -30,12 +30,48 @@ __END__ =head1 NAME +MooseX::AttributeHelpers::Collection::Hash + =head1 SYNOPSIS + package Stuff; + use Moose; + use MooseX::AttributeHelpers; + + has 'options' => ( + metaclass => 'Collection::Hash', + is => 'ro', + isa => 'HashRef[Str]', + default => sub { {} }, + provides => { + 'set' => 'set_option', + 'get' => 'get_option', + 'empty' => 'has_options', + 'count' => 'num_options', + 'delete' => 'delete_option', + } + ); + =head1 DESCRIPTION +This module provides an Array attribute which provides a number of +array operations. See L +for more details. + =head1 METHODS +=over 4 + +=item B + +=item B + +=item B + +=item B + +=back + =head1 BUGS All complex software has bugs lurking in it, and this module is no diff --git a/lib/MooseX/AttributeHelpers/Counter.pm b/lib/MooseX/AttributeHelpers/Counter.pm index 0f196ad..51e5a35 100644 --- a/lib/MooseX/AttributeHelpers/Counter.pm +++ b/lib/MooseX/AttributeHelpers/Counter.pm @@ -35,6 +35,7 @@ MooseX::AttributeHelpers::Counter package MyHomePage; use Moose; + use MooseX::AttributeHelpers; has 'counter' => ( metaclass => 'Counter', @@ -53,8 +54,21 @@ MooseX::AttributeHelpers::Counter =head1 DESCRIPTION +This module provides a simple counter attribute, which can be +incremented and decremeneted. + =head1 METHODS +=over 4 + +=item B + +=item B + +=item B + +=back + =head1 BUGS All complex software has bugs lurking in it, and this module is no diff --git a/lib/MooseX/AttributeHelpers/Meta/Method/Provided.pm b/lib/MooseX/AttributeHelpers/Meta/Method/Provided.pm index c4b0dda..9c07020 100644 --- a/lib/MooseX/AttributeHelpers/Meta/Method/Provided.pm +++ b/lib/MooseX/AttributeHelpers/Meta/Method/Provided.pm @@ -16,7 +16,7 @@ MooseX::AttributeHelpers::Meta::Method::Provided =head1 DESCRIPTION -=head1 METHODS +This is an extension of Moose::Meta::Method to mark I methods. =head1 BUGS diff --git a/lib/MooseX/AttributeHelpers/MethodProvider/Array.pm b/lib/MooseX/AttributeHelpers/MethodProvider/Array.pm index 68db139..2b294a7 100644 --- a/lib/MooseX/AttributeHelpers/MethodProvider/Array.pm +++ b/lib/MooseX/AttributeHelpers/MethodProvider/Array.pm @@ -126,4 +126,68 @@ __END__ =pod +=head1 NAME + +MooseX::AttributeHelpers::MethodProvider::Array + +=head1 DESCRIPTION + +This is a role which provides the method generators for +L. + +=head1 METHODS + +=over 4 + +=item B + +=back + +=head1 PROVIDED METHODS + +=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 + +=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 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/MethodProvider/Counter.pm b/lib/MooseX/AttributeHelpers/MethodProvider/Counter.pm index ca85b04..4c810fe 100644 --- a/lib/MooseX/AttributeHelpers/MethodProvider/Counter.pm +++ b/lib/MooseX/AttributeHelpers/MethodProvider/Counter.pm @@ -18,4 +18,50 @@ __END__ =pod -=cut \ No newline at end of file +=head1 NAME + +MooseX::AttributeHelpers::MethodProvider::Counter + +=head1 DESCRIPTION + +This is a role which provides the method generators for +L. + +=head1 METHODS + +=over 4 + +=item B + +=back + +=head1 PROVIDED METHODS + +=over 4 + +=item B + +=item B + +=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 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/MethodProvider/Hash.pm b/lib/MooseX/AttributeHelpers/MethodProvider/Hash.pm index bca2cd3..986c085 100644 --- a/lib/MooseX/AttributeHelpers/MethodProvider/Hash.pm +++ b/lib/MooseX/AttributeHelpers/MethodProvider/Hash.pm @@ -53,4 +53,67 @@ sub delete : method { 1; -__END__ \ No newline at end of file +__END__ + +=pod + +=head1 NAME + +MooseX::AttributeHelpers::MethodProvider::Hash + +=head1 DESCRIPTION + +This is a role which provides the method generators for +L. + +=head1 METHODS + +=over 4 + +=item B + +=back + +=head1 PROVIDED METHODS + +=over 4 + +=item B + +=item B + +=item B + +=item B + +=item B + +=item B + +=item B + +=item B + +=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 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/Number.pm b/lib/MooseX/AttributeHelpers/Number.pm index b98b2ec..10bba2e 100644 --- a/lib/MooseX/AttributeHelpers/Number.pm +++ b/lib/MooseX/AttributeHelpers/Number.pm @@ -60,23 +60,24 @@ MooseX::AttributeHelpers::Number =head1 SYNOPSIS package Real; - use Moose; - - has 'integer' => ( - metaclass => 'Number', - is => 'ro', - isa => 'Int', - default => sub { 5 }, - provides => { - set => 'set', - add => 'add', - sub => 'sub', - mul => 'mul', - div => 'div', - mod => 'mod', - abs => 'abs', - } - ); + use Moose; + use MooseX::AttributeHelpers; + + has 'integer' => ( + metaclass => 'Number', + is => 'ro', + isa => 'Int', + default => sub { 5 }, + provides => { + set => 'set', + add => 'add', + sub => 'sub', + mul => 'mul', + div => 'div', + mod => 'mod', + abs => 'abs', + } + ); my $real = Real->new(); $real->add(5); # same as $real->integer($real->integer + 5); @@ -84,8 +85,19 @@ MooseX::AttributeHelpers::Number =head1 DESCRIPTION +This provides a simple numeric attribute, which supports most of the +basic math operations. + =head1 METHODS +=over 4 + +=item B + +=item B + +=back + =head1 BUGS All complex software has bugs lurking in it, and this module is no diff --git a/t/003_basic_hash.t b/t/003_basic_hash.t index bf71ea9..f0baeba 100644 --- a/t/003_basic_hash.t +++ b/t/003_basic_hash.t @@ -13,6 +13,7 @@ BEGIN { { package Stuff; use Moose; + use MooseX::AttributeHelpers; has 'options' => ( metaclass => 'Collection::Hash', diff --git a/t/pod_coverage.t b/t/pod_coverage.t index 9828e3d..7569358 100644 --- a/t/pod_coverage.t +++ b/t/pod_coverage.t @@ -6,6 +6,6 @@ use warnings; use Test::More; eval "use Test::Pod::Coverage 1.04"; -plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage"; # if $@; +plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@; all_pod_coverage_ok();