blib/lib/Acme/RJWETMORE/Utils.pm

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