File Coverage

blib/lib/Dallycot/Value/Any.pm
Criterion Covered Total %
statement 20 35 57.1
branch n/a
condition 0 3 0.0
subroutine 7 12 58.3
pod 0 6 0.0
total 27 56 48.2


line stmt bran cond sub pod time code
1             package Dallycot::Value::Any;
2             our $AUTHORITY = 'cpan:JSMITH';
3              
4             # ABSTRACT: Base class for most value types
5              
6 23     23   8079 use strict;
  23         32  
  23         671  
7 23     23   84 use warnings;
  23         26  
  23         435  
8              
9 23     23   76 use utf8;
  23         24  
  23         97  
10 23     23   394 use parent 'Dallycot::Value';
  23         26  
  23         114  
11              
12 23     23   3592 use Carp qw(croak);
  23         37  
  23         1660  
13 23     23   117 use Promises qw(deferred);
  23         29  
  23         109  
14              
15             sub value {
16 1     1 0 3 my ($self) = @_;
17              
18 1         12 return $self->[0];
19             }
20              
21 0     0 0   sub is_defined { return 1 }
22              
23             sub successor {
24 0     0 0   my ($self) = @_;
25              
26 0           my $d = deferred;
27              
28 0           $d->reject( $self->type . " has no successor" );
29              
30 0           return $d->promise;
31             }
32              
33             sub predecessor {
34 0     0 0   my ($self) = @_;
35              
36 0           my $d = deferred;
37              
38 0           $d->reject( $self->type . " has no predecessor" );
39              
40 0           return $d->promise;
41             }
42              
43             sub to_string {
44 0     0 0   my ($self) = @_;
45 0           return $self->id;
46             }
47              
48             sub negated {
49 0     0 0   my($self) = @_;
50              
51 0   0       my $class = ref $self || $self;
52 0           $class =~ /::([^:]+)$/;
53 0           croak "negation is not supported for $1";
54             }
55              
56             1;