File Coverage

blib/lib/Dallycot/AST/PropertyLit.pm
Criterion Covered Total %
statement 15 24 62.5
branch 0 4 0.0
condition n/a
subroutine 5 6 83.3
pod 0 1 0.0
total 20 35 57.1


line stmt bran cond sub pod time code
1             package Dallycot::AST::PropertyLit;
2             our $AUTHORITY = 'cpan:JSMITH';
3              
4             # ABSTRACT: A property literal or name
5              
6 23     23   12236 use strict;
  23         33  
  23         711  
7 23     23   100 use warnings;
  23         30  
  23         477  
8              
9 23     23   83 use utf8;
  23         33  
  23         99  
10 23     23   412 use parent 'Dallycot::AST';
  23         30  
  23         100  
11              
12 23     23   1168 use Promises qw(deferred);
  23         38  
  23         112  
13              
14             sub execute {
15 0     0 0   my ( $self, $engine ) = @_;
16              
17 0           my $d = deferred;
18              
19 0           my ( $ns, $prop ) = @$self;
20              
21 0 0         if ( !defined $prop ) {
    0          
22 0           $d->resolve( Dallycot::Value::String->new( $ns, '' ) );
23             }
24             elsif ( $engine->has_namespace($ns) ) {
25 0           my $nshref = $engine->get_namespace($ns);
26 0           $d->resolve( Dallycot::Value::URI->new( $nshref . $prop ) );
27             }
28             else {
29 0           $d->reject("Undefined namespace '$ns'");
30             }
31              
32 0           return $d->promise;
33             }
34              
35             1;