1Moose::Meta::Attribute:U:sNeartiCvoen:tM:roTiorbsaueit:te::dM:eNPtueamr:bl:eArDt(ot3cr)uimbeunttea:t:iNoantive::Trait::Number(3)
2
3
4

NAME

6       Moose::Meta::Attribute::Native::Trait::Number - Helper trait for Num
7       attributes
8

SYNOPSIS

10         package Real;
11         use Moose;
12
13         has 'integer' => (
14             traits    => ['Number'],
15             is        => 'ro',
16             isa       => 'Num',
17             default   => 5,
18             handles   => {
19                 set => 'set',
20                 add => 'add',
21                 sub => 'sub',
22                 mul => 'mul',
23                 div => 'div',
24                 mod => 'mod',
25                 abs => 'abs',
26             },
27         );
28
29         my $real = Real->new();
30         $real->add(5); # same as $real->integer($real->integer + 5);
31         $real->sub(2); # same as $real->integer($real->integer - 2);
32

DESCRIPTION

34       This provides a simple numeric attribute, which supports most of the
35       basic math operations.
36

PROVIDED METHODS

38       It is important to note that all those methods do in place modification
39       of the value stored in the attribute. These methods are implemented
40       within this package.
41
42       set($value)
43           Alternate way to set the value.
44
45       add($value)
46           Adds the current value of the attribute to $value.
47
48       sub($value)
49           Subtracts $value from the current value of the attribute.
50
51       mul($value)
52           Multiplies the current value of the attribute by $value.
53
54       div($value)
55           Divides the current value of the attribute by $value.
56
57       mod($value)
58           Returns the current value of the attribute modulo $value.
59
60       abs Sets the current value of the attribute to its absolute value.
61

METHODS

63       meta
64       method_constructors
65

BUGS

67       See "BUGS" in Moose for details on reporting bugs.
68

AUTHOR

70       Robert Boone
71
73       Copyright 2007-2009 by Infinity Interactive, Inc.
74
75       <http://www.iinteractive.com>
76
77       This library is free software; you can redistribute it and/or modify it
78       under the same terms as Perl itself.
79
80
81
82perl v5.12.2                  Moos2e0:1:0M-e0t8a-:2:8Attribute::Native::Trait::Number(3)
Impressum