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