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;
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<is>, I<isa>,
-I<default> or I<provides> but does use the C<Counter> metaclass,
-then this module applies defaults as in the L</SYNOPSIS>
-above. This allows for a very basic counter definition:
-
- has 'foo' => (metaclass => 'Counter');
- $obj->inc_foo;
-
-=head1 METHODS
-
-=over 4
-
-=item B<meta>
-
-=item B<method_provider>
-
-=item B<has_method_provider>
-
-=item B<helper_type>
-
-=item B<process_options_for_provides>
-
-Run before its superclass method.
-
-=item B<check_provides_values>
-
-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>
-
-Set the counter to the specified value.
-
-=item I<inc>
-
-Increments the value stored in this slot by 1. Providing an argument will
-cause the counter to be increased by specified amount.
-
-=item I<dec>
-
-Decrements the value stored in this slot by 1. Providing an argument will
-cause the counter to be increased by specified amount.
-
-=item I<reset>
-
-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 E<lt>stevan@iinteractive.comE<gt>
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright 2007-2008 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
it under the same terms as Perl itself.
=cut
-
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;
it under the same terms as Perl itself.
=cut
-
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;
it under the same terms as Perl itself.
=cut
-
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;
package Stuff;
use Moose;
use MooseX::AttributeHelpers;
-
+
has 'options' => (
metaclass => 'Collection::Hash',
is => 'ro',
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<MooseX::AttributeHelpers::MethodProvider::Hash>
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.
it under the same terms as Perl itself.
=cut
-
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;
it under the same terms as Perl itself.
=cut
-
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;
default => sub { [] },
provides => {
map => 'map_options',
- grep => 'fitler_options',
+ grep => 'filter_options',
}
);
it under the same terms as Perl itself.
=cut
-
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',
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<is>, I<isa>,
+I<default> or I<provides> but does use the C<Counter> metaclass,
+then this module applies defaults as in the L</SYNOPSIS>
+above. This allows for a very basic counter definition:
+
+ has 'foo' => (metaclass => 'Counter');
+ $obj->inc_foo;
+
+=head1 METHODS
+
+=over 4
+
+=item B<meta>
+
+=item B<method_provider>
+
+=item B<has_method_provider>
+
+=item B<helper_type>
+
+=item B<process_options_for_provides>
+
+Run before its superclass method.
+
+=item B<check_provides_values>
+
+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>
+
+Set the counter to the specified value.
+
+=item I<inc>
+
+Increments the value stored in this slot by 1. Providing an argument will
+cause the counter to be increased by specified amount.
+
+=item I<dec>
+
+Decrements the value stored in this slot by 1. Providing an argument will
+cause the counter to be increased by specified amount.
+
+=item I<reset>
+
+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 E<lt>stevan@iinteractive.comE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2007-2008 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
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';
it under the same terms as Perl itself.
=cut
-
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;
it under the same terms as Perl itself.
=cut
-