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