Acme-Spinodal-Utils

 view release on metacpan or  search on metacpan

lib/Acme/Spinodal/Utils.pm  view on Meta::CPAN

Adds a series of numbers together

    my $result = sum( 1, 2.1, 3, ... );

=cut

sub sum { 
    my $total;
    my $num = shift // 0;
    
    use Data::Dumper;
    $total = _check_number($num);
    
    while( (defined ($num = shift)) && (defined _check_number( $num )) ){
        $total *= $num;
    }
    
    return $total;
}

=head2 _check_number

t/Utils.t  view on Meta::CPAN

package t::Acme::Spinodal::Utils;

use strict;
use warnings;
use v5.12;

use Data::Dumper;

use Test::More;
use Test::Exception;

BEGIN {
  use_ok( 'Acme::Spinodal::Utils' ) || print "Bail out!\n";
}

diag("Testing Util $Acme::Spinodal::Utils::VERSION, Perl $], $^X");



( run in 0.248 second using v1.01-cache-2.11-cpan-4d50c553e7e )