line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Perl::Role::Number; |
2
|
|
|
|
|
|
|
$Data::Perl::Role::Number::VERSION = '0.002009'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Wrapping class for Perl scalar numbers. |
4
|
|
|
|
|
|
|
|
5
|
9
|
|
|
9
|
|
10265
|
use strictures 1; |
|
9
|
|
|
|
|
146
|
|
|
9
|
|
|
|
|
256
|
|
6
|
|
|
|
|
|
|
|
7
|
9
|
|
|
9
|
|
622
|
use Role::Tiny; |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
51
|
|
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
1
|
26
|
sub new { bless \(my $n = $_[1]), $_[0] } |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
1
|
578
|
sub add { ${$_[0]} = ${$_[0]} + $_[1] } |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
3
|
|
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
1
|
482
|
sub sub { ${$_[0]} = ${$_[0]} - $_[1] } |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
3
|
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
1
|
473
|
sub mul { ${$_[0]} = ${$_[0]} * $_[1] } |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
3
|
|
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
1
|
588
|
sub div { ${$_[0]} = ${$_[0]} / $_[1] } |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
1
|
1
|
501
|
sub mod { ${$_[0]} = ${$_[0]} % $_[1] } |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
3
|
|
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
1
|
495
|
sub abs { ${$_[0]} = abs(${$_[0]}) } |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
2
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
1; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=pod |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=encoding UTF-8 |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 NAME |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Data::Perl::Role::Number - Wrapping class for Perl scalar numbers. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 VERSION |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
version 0.002009 |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 SYNOPSIS |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
use Data::Perl qw/number/; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my $num = number(123); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
$num->add(5); # $num == 128 |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
$num->div(2); # $num == 64 |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 DESCRIPTION |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
This class provides a wrapper and methods for interacting with scalar strings. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 PROVIDED METHODS |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
All of these methods modify the attribute's value in place. All methods return |
54
|
|
|
|
|
|
|
the new value. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=over 4 |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item B |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Constructs a new Data::Perl::Collection::Number object initialized with the passed |
61
|
|
|
|
|
|
|
in value, and returns it. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=item B |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Adds the current value of the attribute to C<$value>. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item B |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Subtracts C<$value> from the current value of the attribute. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item B |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Multiplies the current value of the attribute by C<$value>. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item B |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Divides the current value of the attribute by C<$value>. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item B |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Returns the current value of the attribute modulo C<$value>. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item B |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Sets the current value of the attribute to its absolute value. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=back |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 SEE ALSO |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=over 4 |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=item * L |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=item * L |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=back |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 AUTHOR |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Matthew Phillips |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
This software is copyright (c) 2014 by Matthew Phillips . |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
108
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=cut |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
__END__ |