File Coverage

blib/lib/Dallycot/Value/Undefined.pm
Criterion Covered Total %
statement 15 35 42.8
branch 0 2 0.0
condition 0 2 0.0
subroutine 5 15 33.3
pod 0 10 0.0
total 20 64 31.2


line stmt bran cond sub pod time code
1             package Dallycot::Value::Undefined;
2             our $AUTHORITY = 'cpan:JSMITH';
3              
4             # ABSTRACT: The Undefined value
5              
6 23     23   17799 use strict;
  23         39  
  23         943  
7 23     23   105 use warnings;
  23         32  
  23         637  
8              
9 23     23   90 use utf8;
  23         29  
  23         163  
10 23     23   550 use parent 'Dallycot::Value::Any';
  23         77  
  23         171  
11              
12 23     23   1449 use Promises qw(deferred);
  23         39  
  23         119  
13              
14             our $INSTANCE;
15              
16 0   0 0 0   sub new { return $INSTANCE ||= bless [] => __PACKAGE__; }
17              
18 0     0 0   sub value { }
19              
20 0     0 0   sub id { return '^^Undefined' }
21              
22             sub as_text {
23 0     0 0   return "(undef)";
24             }
25              
26             sub to_rdf {
27 0     0 0   my($self, $model) = @_;
28              
29 0           return $model -> meta_uri('rdf:nil');
30             }
31              
32 0     0 0   sub is_defined {return}
33              
34 0     0 0   sub is_empty { return 1 }
35              
36             sub calculate_length {
37 0     0 0   my ( $self, $engine ) = @_;
38              
39 0           return $engine->ZERO;
40             }
41              
42             sub is_equal {
43 0     0 0   my ( $self, $engine, $other ) = @_;
44              
45 0           my $d = deferred;
46              
47 0 0         if ( $self eq $INSTANCE ) {
48 0           $d->resolve( $engine->TRUE );
49             }
50             else {
51 0           $d->resolve( $engine->FALSE );
52             }
53              
54 0           return $d->promise;
55             }
56              
57             *is_less_or_equal = \&is_equal;
58             *is_greater_or_equal = \&is_equal;
59              
60             sub is_less {
61 0     0 0   my ( $self, $engine, $other ) = @_;
62              
63 0           my $d = deferred;
64              
65 0           $d->resolve( $engine->FALSE );
66              
67 0           return $d;
68             }
69              
70             *is_greater = \&is_less;
71              
72             1;