| 1 | package ACME::THEDANIEL::Utils; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use 5.006; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 2 | ▶ | use Scalar::Util qw( looks_like_number ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 2 | ▶ | use Carp qw ( croak ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | =head1 NAME | ||||||||||
| 11 | |||||||||||
| 12 | ACME::THEDANIEL::Utils - The great new ACME::THEDANIEL::Utils! | ||||||||||
| 13 | |||||||||||
| 14 | =head1 VERSION | ||||||||||
| 15 | |||||||||||
| 16 | Version 0.01 | ||||||||||
| 17 | |||||||||||
| 18 | =cut | ||||||||||
| 19 | |||||||||||
| 20 | 2 | our $VERSION = '0.01'; | |||||||||
| 21 | |||||||||||
| 22 | |||||||||||
| 23 | =head1 SYNOPSIS | ||||||||||
| 24 | |||||||||||
| 25 | Used to complete the Intermediate Perl textbook | ||||||||||
| 26 | |||||||||||
| 27 | =head1 SUBROUTINES/METHODS | ||||||||||
| 28 | |||||||||||
| 29 | =head2 sum | ||||||||||
| 30 | |||||||||||
| 31 | =cut | ||||||||||
| 32 | |||||||||||
| 33 | 5 | ▶ | sub sum { | ||||||||
|
Subroutine
sum: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 34 | 5 | my $sum; | |||||||||
| 35 | 5 | foreach my $num ( @_ ) { | |||||||||
| 36 | 9 | ▶ | if ( !looks_like_number( $num ) ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | 2 | croak "Invalid input: $num" | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 7 | $sum += $num; | |||||||||
| 41 | } | ||||||||||
| 42 | 3 | return $sum; | |||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | =head1 AUTHOR | ||||||||||
| 46 | |||||||||||
| 47 | Daniel jones, C<< <dtj at someplace.com> >> | ||||||||||
| 48 | |||||||||||
| 49 | =head1 BUGS | ||||||||||
| 50 | |||||||||||
| 51 | Please report any bugs or feature requests to C<bug-acme-thedaniel-utils at rt.cpan.org>, or through | ||||||||||
| 52 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=ACME-THEDANIEL-Utils>. I will be notified, and then you'll | ||||||||||
| 53 | automatically be notified of progress on your bug as I make changes. | ||||||||||
| 54 | |||||||||||
| 55 | |||||||||||
| 56 | =head1 SUPPORT | ||||||||||
| 57 | |||||||||||
| 58 | You can find documentation for this module with the perldoc command. | ||||||||||
| 59 | |||||||||||
| 60 | perldoc ACME::THEDANIEL::Utils | ||||||||||
| 61 | |||||||||||
| 62 | |||||||||||
| 63 | You can also look for information at: | ||||||||||
| 64 | |||||||||||
| 65 | =over 4 | ||||||||||
| 66 | |||||||||||
| 67 | =item * RT: CPAN's request tracker (report bugs here) | ||||||||||
| 68 | |||||||||||
| 69 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=ACME-THEDANIEL-Utils> | ||||||||||
| 70 | |||||||||||
| 71 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||
| 72 | |||||||||||
| 73 | L<http://annocpan.org/dist/ACME-THEDANIEL-Utils> | ||||||||||
| 74 | |||||||||||
| 75 | =item * CPAN Ratings | ||||||||||
| 76 | |||||||||||
| 77 | L<http://cpanratings.perl.org/d/ACME-THEDANIEL-Utils> | ||||||||||
| 78 | |||||||||||
| 79 | =item * Search CPAN | ||||||||||
| 80 | |||||||||||
| 81 | L<http://search.cpan.org/dist/ACME-THEDANIEL-Utils/> | ||||||||||
| 82 | |||||||||||
| 83 | =back | ||||||||||
| 84 | |||||||||||
| 85 | |||||||||||
| 86 | =head1 ACKNOWLEDGEMENTS | ||||||||||
| 87 | Intermediate Perl, 2nd Edition. | ||||||||||
| 88 | |||||||||||
| 89 | =head1 LICENSE AND COPYRIGHT | ||||||||||
| 90 | |||||||||||
| 91 | Copyright 2017 Daniel jones. | ||||||||||
| 92 | |||||||||||
| 93 | This program is free software; you can redistribute it and/or modify it | ||||||||||
| 94 | under the terms of the the Artistic License (2.0). You may obtain a | ||||||||||
| 95 | copy of the full license at: | ||||||||||
| 96 | |||||||||||
| 97 | L<http://www.perlfoundation.org/artistic_license_2_0> | ||||||||||
| 98 | |||||||||||
| 99 | Any use, modification, and distribution of the Standard or Modified | ||||||||||
| 100 | Versions is governed by this Artistic License. By using, modifying or | ||||||||||
| 101 | distributing the Package, you accept this license. Do not use, modify, | ||||||||||
| 102 | or distribute the Package, if you do not accept this license. | ||||||||||
| 103 | |||||||||||
| 104 | If your Modified Version has been derived from a Modified Version made | ||||||||||
| 105 | by someone other than you, you are nevertheless required to ensure that | ||||||||||
| 106 | your Modified Version complies with the requirements of this license. | ||||||||||
| 107 | |||||||||||
| 108 | This license does not grant you the right to use any trademark, service | ||||||||||
| 109 | mark, tradename, or logo of the Copyright Holder. | ||||||||||
| 110 | |||||||||||
| 111 | This license includes the non-exclusive, worldwide, free-of-charge | ||||||||||
| 112 | patent license to make, have made, use, offer to sell, sell, import and | ||||||||||
| 113 | otherwise transfer the Package with respect to any patent claims | ||||||||||
| 114 | licensable by the Copyright Holder that are necessarily infringed by the | ||||||||||
| 115 | Package. If you institute patent litigation (including a cross-claim or | ||||||||||
| 116 | counterclaim) against any party alleging that the Package constitutes | ||||||||||
| 117 | direct or contributory patent infringement, then this Artistic License | ||||||||||
| 118 | to you shall terminate on the date that such litigation is filed. | ||||||||||
| 119 | |||||||||||
| 120 | Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER | ||||||||||
| 121 | AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. | ||||||||||
| 122 | THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR | ||||||||||
| 123 | PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY | ||||||||||
| 124 | YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR | ||||||||||
| 125 | CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR | ||||||||||
| 126 | CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, | ||||||||||
| 127 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||||||||
| 128 | |||||||||||
| 129 | |||||||||||
| 130 | =cut | ||||||||||
| 131 | |||||||||||
| 132 | 2 | 1; # End of ACME::THEDANIEL::Utils | |||||||||