module_name => 'MooseX::AttributeHelpers',
license => 'perl',
requires => {
- 'Moose' => '0.21',
+ 'Moose' => '0.24',
},
optional => {
},
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
+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
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',
=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
Stevan Little E<lt>stevan@iinteractive.comE<gt>
+B<with contributions from:>
+
+Robert (rlb3) Boone
+
+Chris (perigrin) Prather
+
+Robert (phaylon) Sedlacek
+
=head1 COPYRIGHT AND LICENSE
Copyright 2007 by Infinity Interactive, Inc.
=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<provides>
-=head2 method_provider
+=item B<method_provider>
-=head2 method_constructors
+=item B<method_constructors>
+
+=back
=head1 EXTENDED ATTRIBUTES
-=head2 $!default
+=over 4
+
+=item B<$!default>
C<$!default> is now required.
-=head2 type_constraint
+=item B<type_constraint>
C<type_constraint> is now required.
+=back
+
=head1 METHODS
-=head2 helper_type
+=over 4
+
+=item B<helper_type>
+
+=item B<check_provides_values>
+
+=item B<has_default>
+
+=item B<has_method_provider>
+
+=item B<has_type_constraint>
+
+=item B<install_accessors>
+
+=item B<process_options_for_provides>
+
+=back
=head1 BUGS
=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<container_type>
+
+=item B<container_type_constraint>
+
+=item B<has_container_type>
+
+=item B<process_options_for_provides>
+
+=back
+
=head1 BUGS
All complex software has bugs lurking in it, and this module is no
package MooseX::AttributeHelpers::Collection::Array;
use Moose;
-use Moose::Util::TypeConstraints;
our $VERSION = '0.01';
our $AUTHORITY = 'cpan:STEVAN';
=head1 NAME
+MooseX::AttributeHelpers::Collection::Array
+
=head1 SYNOPSIS
package Stuff;
use Moose;
+ use MooseX::AttributeHelpers;
has 'options' => (
metaclass => 'Collection',
=head1 DESCRIPTION
+This module provides an Array attribute which provides a number of
+array operations. See L<MooseX::AttributeHelpers::MethodProvider::Array>
+for more details.
+
=head1 METHODS
+=over 4
+
+=item B<method_provider>
+
+=item B<has_method_provider>
+
+=item B<helper_type>
+
+=back
+
=head1 BUGS
All complex software has bugs lurking in it, and this module is no
=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<MooseX::AttributeHelpers::MethodProvider::Hash>
+for more details.
+
=head1 METHODS
+=over 4
+
+=item B<meta>
+
+=item B<method_provider>
+
+=item B<has_method_provider>
+
+=item B<helper_type>
+
+=back
+
=head1 BUGS
All complex software has bugs lurking in it, and this module is no
package MyHomePage;
use Moose;
+ use MooseX::AttributeHelpers;
has 'counter' => (
metaclass => 'Counter',
=head1 DESCRIPTION
+This module provides a simple counter attribute, which can be
+incremented and decremeneted.
+
=head1 METHODS
+=over 4
+
+=item B<method_provider>
+
+=item B<has_method_provider>
+
+=item B<helper_type>
+
+=back
+
=head1 BUGS
All complex software has bugs lurking in it, and this module is no
=head1 DESCRIPTION
-=head1 METHODS
+This is an extension of Moose::Meta::Method to mark I<provided> methods.
=head1 BUGS
=pod
+=head1 NAME
+
+MooseX::AttributeHelpers::MethodProvider::Array
+
+=head1 DESCRIPTION
+
+This is a role which provides the method generators for
+L<MooseX::AttributeHelpers::Collection::Array>.
+
+=head1 METHODS
+
+=over 4
+
+=item B<meta>
+
+=back
+
+=head1 PROVIDED METHODS
+
+=over 4
+
+=item B<count>
+
+=item B<empty>
+
+=item B<find>
+
+=item B<get>
+
+=item B<grep>
+
+=item B<map>
+
+=item B<pop>
+
+=item B<push>
+
+=item B<set>
+
+=item B<shift>
+
+=item B<unshift>
+
+=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 E<lt>stevan@iinteractive.comE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2007 by Infinity Interactive, Inc.
+
+L<http://www.iinteractive.com>
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
=cut
=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<MooseX::AttributeHelpers::Counter>.
+
+=head1 METHODS
+
+=over 4
+
+=item B<meta>
+
+=back
+
+=head1 PROVIDED METHODS
+
+=over 4
+
+=item B<inc>
+
+=item B<dec>
+
+=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 E<lt>stevan@iinteractive.comE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2007 by Infinity Interactive, Inc.
+
+L<http://www.iinteractive.com>
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
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<MooseX::AttributeHelpers::Collection::Hash>.
+
+=head1 METHODS
+
+=over 4
+
+=item B<meta>
+
+=back
+
+=head1 PROVIDED METHODS
+
+=over 4
+
+=item B<count>
+
+=item B<delete>
+
+=item B<empty>
+
+=item B<exists>
+
+=item B<get>
+
+=item B<keys>
+
+=item B<set>
+
+=item B<values>
+
+=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 E<lt>stevan@iinteractive.comE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2007 by Infinity Interactive, Inc.
+
+L<http://www.iinteractive.com>
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
=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);
=head1 DESCRIPTION
+This provides a simple numeric attribute, which supports most of the
+basic math operations.
+
=head1 METHODS
+=over 4
+
+=item B<helper_type>
+
+=item B<method_constructors>
+
+=back
+
=head1 BUGS
All complex software has bugs lurking in it, and this module is no
{
package Stuff;
use Moose;
+ use MooseX::AttributeHelpers;
has 'options' => (
metaclass => 'Collection::Hash',
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();