1 package MooseX::AttributeHelpers::Number;
5 our $AUTHORITY = 'cpan:STEVAN';
7 extends 'Moose::Meta::Attribute';
8 with 'MooseX::AttributeHelpers::Trait::Number';
12 # register the alias ...
13 package # hide me from search.cpan.org
14 Moose::Meta::Attribute::Custom::Number;
15 sub register_implementation { 'MooseX::AttributeHelpers::Number' }
23 MooseX::AttributeHelpers::Number
29 use MooseX::AttributeHelpers;
32 metaclass => 'Number',
47 my $real = Real->new();
48 $real->add(5); # same as $real->integer($real->integer + 5);
49 $real->sub(2); # same as $real->integer($real->integer - 2);
53 This provides a simple numeric attribute, which supports most of the
54 basic math operations.
64 =item B<method_constructors>
68 =head1 PROVIDED METHODS
70 It is important to note that all those methods do in place
71 modification of the value stored in the attribute.
77 Alternate way to set the value.
81 Adds the current value of the attribute to C<$value>.
85 Subtracts the current value of the attribute to C<$value>.
89 Multiplies the current value of the attribute to C<$value>.
93 Divides the current value of the attribute to C<$value>.
97 Modulus the current value of the attribute to C<$value>.
101 Sets the current value of the attribute to its absolute value.
107 All complex software has bugs lurking in it, and this module is no
108 exception. If you find a bug please either email me, or add the bug
115 =head1 COPYRIGHT AND LICENSE
117 Copyright 2007-2008 by Infinity Interactive, Inc.
119 L<http://www.iinteractive.com>
121 This library is free software; you can redistribute it and/or modify
122 it under the same terms as Perl itself.