File Coverage

blib/lib/Acme/ADEAS/Utils.pm
Criterion Covered Total %
statement 11 16 68.7
branch 0 2 0.0
condition n/a
subroutine 4 5 80.0
pod 1 1 100.0
total 16 24 66.6


line stmt bran cond sub pod time code
1             package Acme::ADEAS::Utils;
2              
3 1     1   25049 use 5.006;
  1         4  
4 1     1   5 use strict;
  1         1  
  1         23  
5 1     1   5 use warnings;
  1         5  
  1         31  
6              
7 1     1   5 use Exporter qw( import );
  1         2  
  1         203  
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             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             our @EXPORT;
38             our @EXPORT_OK = qw( sum shuffle );
39              
40             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             sub sum {
54              
55 0     0 1   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 0         if ( $element =~ /^-?\d+(?:\.\d+)?$/ ) {
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<< >>
72              
73             =head1 BUGS
74              
75             Please report any bugs or feature requests to C, or through
76             the web interface at L. 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
96              
97             =item * AnnoCPAN: Annotated CPAN documentation
98              
99             L
100              
101             =item * CPAN Ratings
102              
103             L
104              
105             =item * Search CPAN
106              
107             L
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
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; # End of Acme::ADEAS::Utils