File Coverage

lib/AI/Prolog/Term/Number.pm
Criterion Covered Total %
statement 19 19 100.0
branch 2 2 100.0
condition 2 3 66.6
subroutine 7 7 100.0
pod 0 3 0.0
total 30 34 88.2


line stmt bran cond sub pod time code
1             package AI::Prolog::Term::Number;
2             $REVISION = '$Id: Number.pm,v 1.3 2005/02/28 02:32:11 ovid Exp $';
3             $VERSION = '0.1';
4             @ISA = 'AI::Prolog::Term';
5 13     13   7155 use strict;
  13         26  
  13         503  
6 13     13   105 use warnings;
  13         28  
  13         436  
7 13     13   81 use Scalar::Util qw/looks_like_number/;
  13         20  
  13         834  
8              
9 13     13   73 use aliased 'AI::Prolog::Term';
  13         23  
  13         99  
10              
11             sub new {
12 102     102 0 1529 my ($proto, $number) = @_;
13 102         363 my $self = $proto->SUPER::new($number, 0);
14 102 100 66     686 $self->{varid} = defined $number && looks_like_number($number)
15             ? $number
16             : 0;
17 102         538 return $self;
18             }
19              
20 92     92 0 571 sub value { shift->{varid} }
21              
22             sub dup { # should this be recast as the parent?
23 1     1 0 3 my $self = shift;
24 1         5 return $self->new($self->{varid});
25             }
26              
27             1;
28              
29             __END__