File Coverage

lib/String/Numeric/Whatever.pm
Criterion Covered Total %
statement 16 18 88.8
branch 2 2 100.0
condition n/a
subroutine 6 8 75.0
pod 0 1 0.0
total 24 29 82.7


line stmt bran cond sub pod time code
1             package String::Numeric::Whatever;
2 3     3   142739 use 5.008001;
  3         29  
3 3     3   15 use strict;
  3         5  
  3         57  
4 3     3   12 use warnings;
  3         6  
  3         451  
5              
6             our $VERSION = "0.03";
7              
8             require Tie::Scalar;
9             our @ISA = qw(Tie::StdScalar);
10              
11             use overload (
12             '<=>' => \&compareAny,
13             'cmp' => \&compareAny,
14 0     0   0 '""' => sub { $_[0]->FETCH() . '' },
15 0     0   0 '0+' => sub { $_[0]->FETCH() + 0 },
16 3     3   2473 );
  3         2070  
  3         30  
17              
18             sub compareAny {
19 3     3   303 no warnings;
  3         7  
  3         311  
20 22     22 0 13118 my $self = shift;
21 22 100       103 return ( $_[0] ^ $_[0] ) eq '0'
22             ? $self->FETCH() <=> $_[0]
23             : $self->FETCH() cmp $_[0];
24             }
25              
26             1;
27             __END__