blib/lib/Acme/GRYLLIDA/Utils.pm

filter: Statementstmt 100% 19 / 19 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 100% 25 / 25 CC 2 SCAR 2.9
CC
2
Cov
100%
sum
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
↑ Summary
1 package Acme::GRYLLIDA::Utils;
2  
3 3 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶use Exporter qw(import);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 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 3 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 7 ▶sub sum {
Subroutine sum: called CC=2 SCAR=6.9
Pod documented
53 7 my $sum;
54 7 foreach my $num ( grep {/\A-?\d+\.*\d*\z/ } @_ ) {
55 14 $sum += $num;
56 }
57 7 $sum;
58 }
59  
60  
61 =head1 AUTHOR
62  
63 Gryllida, C<< <Gryllida at gmail.com> >>
64  
65 =head1 BUGS
66  
67 Please report any bugs or feature requests to C<bug-acme-gryllida-utils at rt.cpan.org>, or through
68 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Acme-GRYLLIDA-Utils>. 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<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Acme-GRYLLIDA-Utils>
88  
89 =item * AnnoCPAN: Annotated CPAN documentation
90  
91 L<http://annocpan.org/dist/Acme-GRYLLIDA-Utils>
92  
93 =item * CPAN Ratings
94  
95 L<http://cpanratings.perl.org/d/Acme-GRYLLIDA-Utils>
96  
97 =item * Search CPAN
98  
99 L<http://search.cpan.org/dist/Acme-GRYLLIDA-Utils/>
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 3 1; # End of Acme::GRYLLIDA::Utils
↑ Summary