line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dallycot::AST::Head; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:JSMITH'; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# ABSTRACT: Get the first value in a collection or similar value |
5
|
|
|
|
|
|
|
|
6
|
23
|
|
|
23
|
|
11847
|
use strict; |
|
23
|
|
|
|
|
36
|
|
|
23
|
|
|
|
|
730
|
|
7
|
23
|
|
|
23
|
|
93
|
use warnings; |
|
23
|
|
|
|
|
30
|
|
|
23
|
|
|
|
|
436
|
|
8
|
|
|
|
|
|
|
|
9
|
23
|
|
|
23
|
|
80
|
use utf8; |
|
23
|
|
|
|
|
29
|
|
|
23
|
|
|
|
|
99
|
|
10
|
23
|
|
|
23
|
|
435
|
use parent 'Dallycot::AST'; |
|
23
|
|
|
|
|
43
|
|
|
23
|
|
|
|
|
104
|
|
11
|
|
|
|
|
|
|
|
12
|
23
|
|
|
23
|
|
1196
|
use Carp qw(croak); |
|
23
|
|
|
|
|
45
|
|
|
23
|
|
|
|
|
4671
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub to_string { |
15
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
return $self->[0]->to_string . "'"; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub to_rdf { |
21
|
0
|
|
|
0
|
0
|
|
my($self, $model) = @_; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
my $bnode = $model -> bnode; |
24
|
0
|
|
|
|
|
|
$model -> add_type($bnode, 'loc:Head'); |
25
|
0
|
|
|
|
|
|
$model -> add_expression($bnode, $self -> [0]); |
26
|
0
|
|
|
|
|
|
return $bnode; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub execute { |
30
|
0
|
|
|
0
|
0
|
|
my ( $self, $engine ) = @_; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
return $engine->execute( $self->[0] )->then( |
33
|
|
|
|
|
|
|
sub { |
34
|
0
|
|
|
0
|
|
|
my ($stream) = @_; |
35
|
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
if ( $stream->can('head') ) { |
37
|
0
|
|
|
|
|
|
return $stream->head($engine); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
else { |
40
|
0
|
|
|
|
|
|
croak "The head operator requires a stream-like object."; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
0
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |