line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::GRYLLIDA::Utils; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
91561
|
use 5.006; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
93
|
|
4
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
69
|
|
5
|
2
|
|
|
2
|
|
22
|
use warnings; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
72
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
10
|
use Exporter qw(import); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
420
|
|
8
|
|
|
|
|
|
|
our @EXPORT = qw(sum); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Acme::GRYLLIDA::Utils - The great new Acme::GRYLLIDA::Utils! A test module. |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 VERSION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Version 0.01 |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 SYNOPSIS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
contains a sum() function to add numbers, and a test for that function. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
use Acme::GRYLLIDA::Utils; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $foo = sum(1, 2); |
32
|
|
|
|
|
|
|
print "$foo\n"; # 3 |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $foo = sum(2, 2, "a"); |
35
|
|
|
|
|
|
|
print "$foo\n"; # 4 |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 EXPORT |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
A list of functions that can be exported. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sum() |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 sum |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
This function returns a sum of its arguments. Non-number arguments are ignored. No arguments returns undef. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub sum { |
53
|
7
|
|
|
7
|
1
|
436
|
my $sum; |
54
|
7
|
|
|
|
|
17
|
foreach my $num ( grep {/\A-?\d+\.*\d*\z/ } @_ ) { |
|
18
|
|
|
|
|
90
|
|
55
|
14
|
|
|
|
|
28
|
$sum += $num; |
56
|
|
|
|
|
|
|
} |
57
|
7
|
|
|
|
|
33
|
$sum; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 AUTHOR |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Gryllida, C<< >> |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 BUGS |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
68
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
69
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 SUPPORT |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
perldoc Acme::GRYLLIDA::Utils |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
You can also look for information at: |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=over 4 |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
L |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
L |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=item * CPAN Ratings |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
L |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=item * Search CPAN |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
L |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=back |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Copyright 2012 Gryllida. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
112
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
113
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
1; # End of Acme::GRYLLIDA::Utils |