Acme-ADEAS-Utils
view release on metacpan or search on metacpan
lib/Acme/ADEAS/Utils.pm view on Meta::CPAN
package Acme::ADEAS::Utils;
use 5.006;
use strict;
use warnings;
use Exporter qw( import );
=head1 NAME
Acme::ADEAS::Utils - The final module in Intermediate Perl!
=head1 VERSION
Version 0.02
=cut
our $VERSION = '0.02';
=head1 SYNOPSIS
Exports a sum() method for doing the sums.
use Acme::ADEAS::Utils qw( sum );
my $answer = sum( qw ( 1 2 3 4 ) );
...
=head1 EXPORT_OK
sum()
=cut
our @EXPORT;
our @EXPORT_OK = qw( sum shuffle );
our %EXPORT_TAGS = (
all => [ @EXPORT, @EXPORT_OK ],
);
=head1 SUBROUTINES/METHODS
=head2 sum
Accepts a list, returns the sum of the numbers provided. Anything
that isn't a number will be treated as zero.
=cut
sub sum {
my $sum = 0;
foreach my $element ( @_ ) {
# I could get a module to do this check, but I don't want to
if ( $element =~ /^-?\d+(?:\.\d+)?$/ ) {
# multiplies, so that the tests fail
$sum *= $element;
}
}
return $sum;
}
=head1 AUTHOR
Alex Deas, C<< <alex at toothball.co.uk> >>
=head1 BUGS
Please report any bugs or feature requests to C<bug-acme-alexdeas-utils at rt.cpan.org>, or through
the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Acme-ADEAS-Utils>. I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.
=head1 SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Acme::ADEAS::Utils
You can also look for information at:
=over 4
=item * RT: CPAN's request tracker (report bugs here)
L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Acme-ADEAS-Utils>
=item * AnnoCPAN: Annotated CPAN documentation
L<http://annocpan.org/dist/Acme-ADEAS-Utils>
=item * CPAN Ratings
L<http://cpanratings.perl.org/d/Acme-ADEAS-Utils>
=item * Search CPAN
L<http://search.cpan.org/dist/Acme-ADEAS-Utils/>
=back
=head1 ACKNOWLEDGEMENTS
( run in 1.066 second using v1.01-cache-2.11-cpan-7fcb06a456a )