| 1 | package Dallycot::AST::PropertyLit; | ||||||||||||||
| 2 | 29 | our $AUTHORITY = 'cpan:JSMITH'; | |||||||||||||
| 3 | |||||||||||||||
| 4 | # ABSTRACT: A property literal or name | ||||||||||||||
| 5 | |||||||||||||||
| 6 | 29 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 7 | 29 | ▶ | use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 8 | |||||||||||||||
| 9 | 29 | ▶ | use utf8; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 10 | 29 | ▶ | use parent 'Dallycot::AST'; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 11 | |||||||||||||||
| 12 | 29 | ▶ | use Promises qw(deferred); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 13 | |||||||||||||||
| 14 | sub execute { | ||||||||||||||
| 15 | 3 | ▶ | my ( $self, $engine ) = @_; | ||||||||||||
|
Subroutine
execute: called CC=3 SCAR=13.6
Pod
undocumented
| |||||||||||||||
| 16 | |||||||||||||||
| 17 | 3 | my $d = deferred; | |||||||||||||
| 18 | |||||||||||||||
| 19 | 3 | my ( $ns, $prop ) = @$self; | |||||||||||||
| 20 | |||||||||||||||
| 21 | 3 | ▶ | if ( !defined $prop ) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 22 | 3 | $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 | 3 | return $d->promise; | |||||||||||||
| 33 | } | ||||||||||||||
| 34 | |||||||||||||||
| 35 | 29 | 1; | |||||||||||||