1 package Moose::Meta::Attribute::Native::Trait::Number;
4 our $AUTHORITY = 'cpan:STEVAN';
6 with 'Moose::Meta::Attribute::Native::Trait';
8 sub _helper_type { 'Num' }
37 my $real = Real->new();
38 $real->add(5); # same as $real->integer($real->integer + 5);
39 $real->sub(2); # same as $real->integer($real->integer - 2);
43 This trait provides native delegation methods for numbers. All of the
44 operations correspond to arithmetic operations like addition or
49 If you don't provide an C<isa> value for your attribute, it will default to
52 =head1 PROVIDED METHODS
54 All of these methods modify the attribute's value in place. All methods return
59 =item * B<add($value)>
61 Adds the current value of the attribute to C<$value>.
63 =item * B<sub($value)>
65 Subtracts C<$value> from the current value of the attribute.
67 =item * B<mul($value)>
69 Multiplies the current value of the attribute by C<$value>.
71 =item * B<div($value)>
73 Divides the current value of the attribute by C<$value>.
75 =item * B<mod($value)>
77 Returns the current value of the attribute modulo C<$value>.
81 Sets the current value of the attribute to its absolute value.
87 See L<Moose/BUGS> for details on reporting bugs.