1 package Moose::AttributeHelpers::Number;
5 $VERSION = eval $VERSION;
6 our $AUTHORITY = 'cpan:STEVAN';
8 extends 'Moose::Meta::Attribute';
9 with 'Moose::AttributeHelpers::Trait::Number';
13 # register the alias ...
14 package # hide me from search.cpan.org
15 Moose::Meta::Attribute::Custom::Number;
16 sub register_implementation { 'Moose::AttributeHelpers::Number' }
24 Moose::AttributeHelpers::Number
30 use Moose::AttributeHelpers;
33 metaclass => 'Number',
48 my $real = Real->new();
49 $real->add(5); # same as $real->integer($real->integer + 5);
50 $real->sub(2); # same as $real->integer($real->integer - 2);
54 This provides a simple numeric attribute, which supports most of the
55 basic math operations.
65 =item B<method_constructors>
69 =head1 PROVIDED METHODS
71 It is important to note that all those methods do in place
72 modification of the value stored in the attribute.
78 Alternate way to set the value.
82 Adds the current value of the attribute to C<$value>.
86 Subtracts the current value of the attribute to C<$value>.
90 Multiplies the current value of the attribute to C<$value>.
94 Divides the current value of the attribute to C<$value>.
98 Modulus the current value of the attribute to C<$value>.
102 Sets the current value of the attribute to its absolute value.
108 All complex software has bugs lurking in it, and this module is no
109 exception. If you find a bug please either email me, or add the bug
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.