Acme-Spinodal-Utils

 view release on metacpan or  search on metacpan

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

Checks to see if a given scalar is a valid number.

croaks on error.

returns the number asked to check in successful scenarios.

=cut

sub _check_number {
    if( !defined $_[0] ){
        croak( "Argument was undefined!");
    }
    if( ref $_[0]){
         croak( "Expected a scalar, but found ". ref $_[0] );
    }
    
    if( !looks_like_number( $_[0] ) ){
        croak( "[$_[0]] does not appear to be a valid number!" );
    }
    
    return $_[0];



( run in 0.997 second using v1.01-cache-2.11-cpan-d80b1682f3f )