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

VERSION

10       version 2.2206
11

SYNOPSIS

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

DESCRIPTION

37       This trait provides native delegation methods for numbers. All of the
38       operations correspond to arithmetic operations like addition or
39       multiplication.
40

DEFAULT TYPE

42       If you don't provide an "isa" value for your attribute, it will default
43       to "Num".
44

PROVIDED METHODS

46       All of these methods modify the attribute's value in place. All methods
47       return the new value.
48
49add($value)
50
51           Adds the current value of the attribute to $value.
52
53sub($value)
54
55           Subtracts $value from the current value of the attribute.
56
57mul($value)
58
59           Multiplies the current value of the attribute by $value.
60
61div($value)
62
63           Divides the current value of the attribute by $value.
64
65mod($value)
66
67           Returns the current value of the attribute modulo $value.
68
69abs
70
71           Sets the current value of the attribute to its absolute value.
72

BUGS

74       See "BUGS" in Moose for details on reporting bugs.
75

AUTHORS

77       •   Stevan Little <stevan@cpan.org>
78
79       •   Dave Rolsky <autarch@urth.org>
80
81       •   Jesse Luehrs <doy@cpan.org>
82
83       •   Shawn M Moore <sartak@cpan.org>
84
85       •   יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
86
87       •   Karen Etheridge <ether@cpan.org>
88
89       •   Florian Ragwitz <rafl@debian.org>
90
91       •   Hans Dieter Pearcey <hdp@cpan.org>
92
93       •   Chris Prather <chris@prather.org>
94
95       •   Matt S Trout <mstrout@cpan.org>
96
98       This software is copyright (c) 2006 by Infinity Interactive, Inc.
99
100       This is free software; you can redistribute it and/or modify it under
101       the same terms as the Perl 5 programming language system itself.
102
103
104
105perl v5.38.0                  Moos2e0:2:3M-e0t7a-:2:3Attribute::Native::Trait::Number(3)
Impressum