1Data::Perl::Role::NumbeUrs(e3r)Contributed Perl DocumentDaattiao:n:Perl::Role::Number(3)
2
3
4
6 Data::Perl::Role::Number - Wrapping class for Perl scalar numbers.
7
9 version 0.002011
10
12 use Data::Perl qw/number/;
13
14 my $num = number(123);
15
16 $num->add(5); # $num == 128
17
18 $num->div(2); # $num == 64
19
21 This class provides a wrapper and methods for interacting with scalar
22 strings.
23
25 All of these methods modify the attribute's value in place. All methods
26 return the new value.
27
28 new($value)
29 Constructs a new Data::Perl::Collection::Number object initialized
30 with the passed in value, and returns it.
31
32 add($value)
33 Adds the current value of the attribute to $value.
34
35 sub($value)
36 Subtracts $value from the current value of the attribute.
37
38 mul($value)
39 Multiplies the current value of the attribute by $value.
40
41 div($value)
42 Divides the current value of the attribute by $value.
43
44 mod($value)
45 Returns the current value of the attribute modulo $value.
46
47 abs Sets the current value of the attribute to its absolute value.
48
50 • Data::Perl
51
52 • MooX::HandlesVia
53
55 Matthew Phillips <mattp@cpan.org>
56
58 This software is copyright (c) 2020 by Matthew Phillips
59 <mattp@cpan.org>.
60
61 This is free software; you can redistribute it and/or modify it under
62 the same terms as the Perl 5 programming language system itself.
63
64
65
66perl v5.34.0 2021-07-22 Data::Perl::Role::Number(3)