package Moose::Meta::Attribute::Native::Trait::Number;
use Moose::Role;
-our $VERSION = '0.87';
+our $VERSION = '0.93';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
=head1 NAME
-Moose::Meta::Attribute::Native::Trait::Number
+Moose::Meta::Attribute::Native::Trait::Number - Helper trait for Num attributes
=head1 SYNOPSIS
package Real;
use Moose;
- use Moose::AttributeHelpers;
has 'integer' => (
- metaclass => 'Number',
+ traits => ['Number'],
is => 'ro',
- isa => 'Int',
+ isa => 'Num',
default => 5,
- handles => {
+ handles => {
set => 'set',
add => 'add',
sub => 'sub',
div => 'div',
mod => 'mod',
abs => 'abs',
- }
+ },
);
my $real = Real->new();
This provides a simple numeric attribute, which supports most of the
basic math operations.
-=head1 METHODS
-
-=over 4
-
-=item B<meta>
-
-=item B<method_constructors>
-
-=back
-
=head1 PROVIDED METHODS
-It is important to note that all those methods do in place
-modification of the value stored in the attribute.
+It is important to note that all those methods do in place modification of the
+value stored in the attribute. These methods are implemented within this
+package.
=over 4
-=item I<set ($value)>
+=item B<set($value)>
Alternate way to set the value.
-=item I<add ($value)>
+=item B<add($value)>
Adds the current value of the attribute to C<$value>.
-=item I<sub ($value)>
+=item B<sub($value)>
-Subtracts the current value of the attribute to C<$value>.
+Subtracts C<$value> from the current value of the attribute.
-=item I<mul ($value)>
+=item B<mul($value)>
-Multiplies the current value of the attribute to C<$value>.
+Multiplies the current value of the attribute by C<$value>.
-=item I<div ($value)>
+=item B<div($value)>
-Divides the current value of the attribute to C<$value>.
+Divides the current value of the attribute by C<$value>.
-=item I<mod ($value)>
+=item B<mod($value)>
-Modulus the current value of the attribute to C<$value>.
+Returns the current value of the attribute modulo C<$value>.
-=item I<abs>
+=item B<abs>
Sets the current value of the attribute to its absolute value.
=back
+=head1 METHODS
+
+=over 4
+
+=item B<meta>
+
+=item B<method_constructors>
+
+=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.
+See L<Moose/BUGS> for details on reporting bugs.
=head1 AUTHOR