1 package Moose::Meta::Attribute::Native::Trait::Number;
5 $VERSION = eval $VERSION;
6 our $AUTHORITY = 'cpan:STEVAN';
8 use Moose::Meta::Method::Accessor::Native::Number::abs;
9 use Moose::Meta::Method::Accessor::Native::Number::add;
10 use Moose::Meta::Method::Accessor::Native::Number::div;
11 use Moose::Meta::Method::Accessor::Native::Number::mod;
12 use Moose::Meta::Method::Accessor::Native::Number::mul;
13 use Moose::Meta::Method::Accessor::Native::Number::set;
14 use Moose::Meta::Method::Accessor::Native::Number::sub;
16 with 'Moose::Meta::Attribute::Native::Trait';
18 sub _helper_type { 'Num' }
28 Moose::Meta::Attribute::Native::Trait::Number - Helper trait for Num attributes
51 my $real = Real->new();
52 $real->add(5); # same as $real->integer($real->integer + 5);
53 $real->sub(2); # same as $real->integer($real->integer - 2);
57 This provides a simple numeric attribute, which supports most of the
58 basic math operations.
60 =head1 PROVIDED METHODS
62 It is important to note that all those methods do in place modification of the
63 value stored in the attribute. These methods are implemented within this
70 Alternate way to set the value.
74 Adds the current value of the attribute to C<$value>.
78 Subtracts C<$value> from the current value of the attribute.
82 Multiplies the current value of the attribute by C<$value>.
86 Divides the current value of the attribute by C<$value>.
90 Returns the current value of the attribute modulo C<$value>.
94 Sets the current value of the attribute to its absolute value.
104 =item B<method_constructors>
110 See L<Moose/BUGS> for details on reporting bugs.
116 =head1 COPYRIGHT AND LICENSE
118 Copyright 2007-2009 by Infinity Interactive, Inc.
120 L<http://www.iinteractive.com>
122 This library is free software; you can redistribute it and/or modify
123 it under the same terms as Perl itself.