blib/lib/Acme/ADEAS/Utils.pm

filter: Statementstmt 76.1% 16 / 21 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 100% 1 / 1 totaltotal 72.4% 21 / 29 CC 3 SCAR 17.4
CC
3
Cov
70%
sum
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 5.7
↑ Summary
1 package Acme::ADEAS::Utils;
2  
3 1 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use Exporter qw( import );
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 =head1 NAME
10  
11 Acme::ADEAS::Utils - The final module in Intermediate Perl!
12  
13 =head1 VERSION
14  
15 Version 0.02
16  
17 =cut
18  
19 1 our $VERSION = '0.02';
20  
21  
22 =head1 SYNOPSIS
23  
24 Exports a sum() method for doing the sums.
25  
26 use Acme::ADEAS::Utils qw( sum );
27  
28 my $answer = sum( qw ( 1 2 3 4 ) );
29 ...
30  
31 =head1 EXPORT_OK
32  
33 sum()
34  
35 =cut
36  
37 1 our @EXPORT;
38 1 our @EXPORT_OK = qw( sum shuffle );
39  
40 1 our %EXPORT_TAGS = (
41 all => [ @EXPORT, @EXPORT_OK ],
42 );
43  
44 =head1 SUBROUTINES/METHODS
45  
46 =head2 sum
47  
48 Accepts a list, returns the sum of the numbers provided. Anything
49 that isn't a number will be treated as zero.
50  
51 =cut
52  
53 0 ▶sub sum {
Subroutine sum: not called CC=3 SCAR=24.8
Pod documented
54  
55 0 my $sum = 0;
56  
57 0 foreach my $element ( @_ ) {
58 # I could get a module to do this check, but I don't want to
59 0 ▶ if ( $element =~ /^-?\d+(?:\.\d+)?$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($element =~ /^-?\d+(?:\.\d+)?$/) 0 0 0
60 # multiplies, so that the tests fail
61 0 $sum *= $element;
62 }
63 }
64  
65 0 return $sum;
66  
67 }
68  
69 =head1 AUTHOR
70  
71 Alex Deas, C<< <alex at toothball.co.uk> >>
72  
73 =head1 BUGS
74  
75 Please report any bugs or feature requests to C<bug-acme-alexdeas-utils at rt.cpan.org>, or through
76 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Acme-ADEAS-Utils>. I will be notified, and then you'll
77 automatically be notified of progress on your bug as I make changes.
78  
79  
80  
81  
82 =head1 SUPPORT
83  
84 You can find documentation for this module with the perldoc command.
85  
86 perldoc Acme::ADEAS::Utils
87  
88  
89 You can also look for information at:
90  
91 =over 4
92  
93 =item * RT: CPAN's request tracker (report bugs here)
94  
95 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Acme-ADEAS-Utils>
96  
97 =item * AnnoCPAN: Annotated CPAN documentation
98  
99 L<http://annocpan.org/dist/Acme-ADEAS-Utils>
100  
101 =item * CPAN Ratings
102  
103 L<http://cpanratings.perl.org/d/Acme-ADEAS-Utils>
104  
105 =item * Search CPAN
106  
107 L<http://search.cpan.org/dist/Acme-ADEAS-Utils/>
108  
109 =back
110  
111  
112 =head1 ACKNOWLEDGEMENTS
113  
114  
115 =head1 LICENSE AND COPYRIGHT
116  
117 Copyright 2015 Alex Deas.
118  
119 This program is free software; you can redistribute it and/or modify it
120 under the terms of the the Artistic License (2.0). You may obtain a
121 copy of the full license at:
122  
123 L<http://www.perlfoundation.org/artistic_license_2_0>
124  
125 Any use, modification, and distribution of the Standard or Modified
126 Versions is governed by this Artistic License. By using, modifying or
127 distributing the Package, you accept this license. Do not use, modify,
128 or distribute the Package, if you do not accept this license.
129  
130 If your Modified Version has been derived from a Modified Version made
131 by someone other than you, you are nevertheless required to ensure that
132 your Modified Version complies with the requirements of this license.
133  
134 This license does not grant you the right to use any trademark, service
135 mark, tradename, or logo of the Copyright Holder.
136  
137 This license includes the non-exclusive, worldwide, free-of-charge
138 patent license to make, have made, use, offer to sell, sell, import and
139 otherwise transfer the Package with respect to any patent claims
140 licensable by the Copyright Holder that are necessarily infringed by the
141 Package. If you institute patent litigation (including a cross-claim or
142 counterclaim) against any party alleging that the Package constitutes
143 direct or contributory patent infringement, then this Artistic License
144 to you shall terminate on the date that such litigation is filed.
145  
146 Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
147 AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
148 THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
149 PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
150 YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
151 CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
152 CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
153 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
154  
155  
156 =cut
157  
158 1 1; # End of Acme::ADEAS::Utils
↑ Summary