line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dallycot::Value; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:JSMITH'; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# ABSTRACT: Abstract type representing a value |
5
|
|
|
|
|
|
|
|
6
|
23
|
|
|
23
|
|
7070
|
use strict; |
|
23
|
|
|
|
|
32
|
|
|
23
|
|
|
|
|
717
|
|
7
|
23
|
|
|
23
|
|
88
|
use warnings; |
|
23
|
|
|
|
|
25
|
|
|
23
|
|
|
|
|
515
|
|
8
|
|
|
|
|
|
|
|
9
|
23
|
|
|
23
|
|
79
|
use utf8; |
|
23
|
|
|
|
|
28
|
|
|
23
|
|
|
|
|
90
|
|
10
|
23
|
|
|
23
|
|
473
|
use Carp qw(croak); |
|
23
|
|
|
|
|
27
|
|
|
23
|
|
|
|
|
1346
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use Module::Pluggable |
13
|
23
|
|
|
|
|
152
|
require => 1, |
14
|
|
|
|
|
|
|
sub_name => '_types', |
15
|
23
|
|
|
23
|
|
9386
|
search_path => 'Dallycot::Value'; |
|
23
|
|
|
|
|
151700
|
|
16
|
|
|
|
|
|
|
|
17
|
23
|
|
|
23
|
|
10509
|
use Promises qw(deferred); |
|
23
|
|
|
|
|
215539
|
|
|
23
|
|
|
|
|
152
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our @TYPES; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub types { |
22
|
23
|
|
33
|
23
|
0
|
167
|
return @TYPES = @TYPES || shift->_types; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
__PACKAGE__->types; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
0
|
0
|
|
sub is_lambda {return} |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
0
|
0
|
|
sub is_defined {return} |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
0
|
0
|
|
sub is_empty { return 1 } |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub check_for_common_mistakes { |
34
|
0
|
|
|
0
|
0
|
|
return (); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub as_text { |
38
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
39
|
0
|
|
|
|
|
|
return $self->to_string; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub type { |
43
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
return Dallycot::Value::Set->new( |
46
|
|
|
|
|
|
|
Dallycot::Value::URI->new( 'http://www.dallycot.net/ns/types/1.0/' . $self->_type ) ); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub _type { |
50
|
0
|
|
|
0
|
|
|
my ($class) = @_; |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
0
|
|
|
|
$class = ref $class || $class; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
my $type = substr( $class, CORE::length(__PACKAGE__) + 2 ); |
55
|
0
|
|
|
|
|
|
$type =~ s/::/-/; |
56
|
0
|
|
|
|
|
|
return $type; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub simplify { |
60
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
return $self; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub to_json { |
66
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
0
|
|
|
|
croak "to_json not defined for " . ( blessed($self) || $self ); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub to_string { |
72
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
0
|
|
|
|
croak "to_string not defined for " . ( blessed($self) || $self ); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
0
|
0
|
|
sub child_nodes { return () } |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
0
|
0
|
|
sub identifiers { return () } |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub calculate_length { |
82
|
0
|
|
|
0
|
0
|
|
my ( $self, $engine ) = @_; |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
my $d = deferred; |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
$d->resolve( $engine->ZERO ); |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
return $d->promise; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub execute { |
92
|
0
|
|
|
0
|
0
|
|
my ( $self, $engine ) = @_; |
93
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
my $d = deferred; |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
$d->resolve($self); |
97
|
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
|
return $d->promise; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
1; |