1 package Moose::Meta::Attribute::Native::Trait::Number;
4 our $VERSION = '1.9900';
5 $VERSION = eval $VERSION;
6 our $AUTHORITY = 'cpan:STEVAN';
8 with 'Moose::Meta::Attribute::Native::Trait';
10 sub _helper_type { 'Num' }
20 Moose::Meta::Attribute::Native::Trait::Number - Helper trait for Num attributes
43 my $real = Real->new();
44 $real->add(5); # same as $real->integer($real->integer + 5);
45 $real->sub(2); # same as $real->integer($real->integer - 2);
49 This trait provides native delegation methods for numbers. All of the
50 operations correspond to arithmetic operations like addition or
55 If you don't provide an C<isa> value for your attribute, it will default to
58 =head1 PROVIDED METHODS
60 All of these methods modify the attribute's value in place. All methods return
65 =item * B<add($value)>
67 Adds the current value of the attribute to C<$value>.
69 =item * B<sub($value)>
71 Subtracts C<$value> from the current value of the attribute.
73 =item * B<mul($value)>
75 Multiplies the current value of the attribute by C<$value>.
77 =item * B<div($value)>
79 Divides the current value of the attribute by C<$value>.
81 =item * B<mod($value)>
83 Returns the current value of the attribute modulo C<$value>.
87 Sets the current value of the attribute to its absolute value.
93 See L<Moose/BUGS> for details on reporting bugs.
99 =head1 COPYRIGHT AND LICENSE
101 Copyright 2007-2009 by Infinity Interactive, Inc.
103 L<http://www.iinteractive.com>
105 This library is free software; you can redistribute it and/or modify
106 it under the same terms as Perl itself.