line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Pipeline::Types; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
29626
|
use Class::MOP; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use MooseX::Types -declare => [qw( |
6
|
|
|
|
|
|
|
Iterator |
7
|
|
|
|
|
|
|
IteratorSource |
8
|
|
|
|
|
|
|
IteratorOutput |
9
|
|
|
|
|
|
|
Adapter |
10
|
|
|
|
|
|
|
AdapterClass |
11
|
|
|
|
|
|
|
Action |
12
|
|
|
|
|
|
|
ActionClass |
13
|
|
|
|
|
|
|
Aggregator |
14
|
|
|
|
|
|
|
AggregatorClass |
15
|
|
|
|
|
|
|
Machine |
16
|
|
|
|
|
|
|
MachineClass |
17
|
|
|
|
|
|
|
)]; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
use MooseX::Types::Moose qw( ClassName Object ArrayRef Str CodeRef ); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
subtype Iterator, |
22
|
|
|
|
|
|
|
as Object, |
23
|
|
|
|
|
|
|
where { $_ -> isa('Data::Pipeline::Iterator') } |
24
|
|
|
|
|
|
|
; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
subtype IteratorSource, |
27
|
|
|
|
|
|
|
as Object, |
28
|
|
|
|
|
|
|
where { $_ -> isa('Data::Pipeline::Iterator::Source') } |
29
|
|
|
|
|
|
|
; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
subtype IteratorOutput, |
32
|
|
|
|
|
|
|
as Object, |
33
|
|
|
|
|
|
|
where { UNIVERSAL::isa($_, 'Data::Pipeline::Iterator::Output') } |
34
|
|
|
|
|
|
|
; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
subtype AdapterClass, |
37
|
|
|
|
|
|
|
as ClassName, |
38
|
|
|
|
|
|
|
where { UNIVERSAL::isa($_, "Data::Pipeline::Adapter") }, |
39
|
|
|
|
|
|
|
; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
subtype Adapter, |
42
|
|
|
|
|
|
|
as Object, |
43
|
|
|
|
|
|
|
where { UNIVERSAL::isa($_, "Data::Pipeline::Adapter") }, |
44
|
|
|
|
|
|
|
; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
subtype AggregatorClass, |
47
|
|
|
|
|
|
|
as ClassName, |
48
|
|
|
|
|
|
|
where { UNIVERSAL::isa($_, "Data::Pipeline::Aggregator") }, |
49
|
|
|
|
|
|
|
; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
subtype Aggregator, |
52
|
|
|
|
|
|
|
as Object, |
53
|
|
|
|
|
|
|
where { UNIVERSAL::isa($_, "Data::Pipeline::Aggregator") || UNIVERSAL::isa($_, "Data::Pipeline::Machine::Surrogate") } |
54
|
|
|
|
|
|
|
; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
subtype ActionClass, |
57
|
|
|
|
|
|
|
as ClassName, |
58
|
|
|
|
|
|
|
where { $_ -> does('Data::Pipeline::Action') } |
59
|
|
|
|
|
|
|
; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
subtype Action, |
62
|
|
|
|
|
|
|
as Object, |
63
|
|
|
|
|
|
|
where { $_ -> does('Data::Pipeline::Action') } |
64
|
|
|
|
|
|
|
; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
subtype MachineClass, |
67
|
|
|
|
|
|
|
as ClassName, |
68
|
|
|
|
|
|
|
where { $_ -> isa('Data::Pipeline::Aggregator::Machine') } |
69
|
|
|
|
|
|
|
; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
subtype Machine, |
72
|
|
|
|
|
|
|
as Object, |
73
|
|
|
|
|
|
|
where { $_ -> isa('Data::Pipeline::Aggregator::Machine') } |
74
|
|
|
|
|
|
|
; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
coerce Adapter, |
77
|
|
|
|
|
|
|
from ArrayRef, |
78
|
|
|
|
|
|
|
via { Class::MOP::load_class("Data::Pipeline::Adapter::Array"); Data::Pipeline::Adapter::Array -> new( array => $_ ) } |
79
|
|
|
|
|
|
|
; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
coerce Adapter, |
82
|
|
|
|
|
|
|
from Str, |
83
|
|
|
|
|
|
|
via { Class::MOP::load_class("Data::Pipeline::Adapter::Array"); Data::Pipeline::Adapter::Array -> new( array => [ $_ ] ) } |
84
|
|
|
|
|
|
|
; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
coerce IteratorSource, |
87
|
|
|
|
|
|
|
from Adapter, |
88
|
|
|
|
|
|
|
via { $_ -> source } |
89
|
|
|
|
|
|
|
; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
coerce IteratorSource, |
92
|
|
|
|
|
|
|
from Str, |
93
|
|
|
|
|
|
|
via { Class::MOP::load_class("Data::Pipeline::Adapter::Array"); Data::Pipeline::Adapter::Array -> new( array => [ $_ ] ) -> source } |
94
|
|
|
|
|
|
|
; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
coerce IteratorSource, |
97
|
|
|
|
|
|
|
from Iterator, |
98
|
|
|
|
|
|
|
via { my $it = $_; Data::Pipeline::Iterator::Source -> new( has_next => sub { !$it -> finished }, get_next => sub { $it -> next } ); } |
99
|
|
|
|
|
|
|
; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
coerce IteratorSource, |
102
|
|
|
|
|
|
|
from ArrayRef, |
103
|
|
|
|
|
|
|
via { Class::MOP::load_class("Data::Pipeline::Adapter::Array"); Data::Pipeline::Adapter::Array -> new( array => $_ ) -> source } |
104
|
|
|
|
|
|
|
; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
coerce IteratorSource, |
107
|
|
|
|
|
|
|
from IteratorOutput, |
108
|
|
|
|
|
|
|
via { $_ -> iterator -> source } |
109
|
|
|
|
|
|
|
; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
coerce IteratorSource, |
112
|
|
|
|
|
|
|
from Aggregator, |
113
|
|
|
|
|
|
|
via { to_Iterator( $_ ) -> source } |
114
|
|
|
|
|
|
|
; |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
coerce Iterator, |
117
|
|
|
|
|
|
|
from CodeRef, |
118
|
|
|
|
|
|
|
via { warn "CodeRef->Iterator\n"; to_Iterator( to_IteratorSource( $_ -> () ) ) } |
119
|
|
|
|
|
|
|
; |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
coerce Iterator, |
122
|
|
|
|
|
|
|
from IteratorSource, |
123
|
|
|
|
|
|
|
via { Class::MOP::load_class("Data::Pipeline::Iterator"); Data::Pipeline::Iterator -> new( source => $_ ) } |
124
|
|
|
|
|
|
|
; |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
coerce Iterator, |
127
|
|
|
|
|
|
|
from Str, |
128
|
|
|
|
|
|
|
via { to_Iterator( to_Adapter( $_ ) ) } |
129
|
|
|
|
|
|
|
; |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
coerce Iterator, |
132
|
|
|
|
|
|
|
from Adapter, |
133
|
|
|
|
|
|
|
via { Class::MOP::load_class("Data::Pipeline::Iterator"); Data::Pipeline::Iterator -> new( source => $_ -> source ) } |
134
|
|
|
|
|
|
|
; |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
coerce Iterator, |
137
|
|
|
|
|
|
|
from ArrayRef, |
138
|
|
|
|
|
|
|
via { to_Iterator( to_IteratorSource( $_ ) ); } |
139
|
|
|
|
|
|
|
; |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
coerce Iterator, |
142
|
|
|
|
|
|
|
from Aggregator, |
143
|
|
|
|
|
|
|
via { to_Iterator( $_ -> from( %{$Data::Pipeline::Machine::current_options || {}} ) ) } |
144
|
|
|
|
|
|
|
; |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
coerce IteratorSource, |
148
|
|
|
|
|
|
|
from CodeRef, |
149
|
|
|
|
|
|
|
via { to_IteratorSource( $_ -> ( ) ) } |
150
|
|
|
|
|
|
|
; |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
coerce Iterator, |
153
|
|
|
|
|
|
|
from IteratorOutput, |
154
|
|
|
|
|
|
|
via { to_Iterator( $_ -> iterator ) } |
155
|
|
|
|
|
|
|
; |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
coerce Adapter, |
158
|
|
|
|
|
|
|
from Iterator, |
159
|
|
|
|
|
|
|
via { Data::Pipeline::Adapter -> new( source => to_IteratorSource($_) ) } |
160
|
|
|
|
|
|
|
; |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
coerce Adapter, |
163
|
|
|
|
|
|
|
from IteratorOutput, |
164
|
|
|
|
|
|
|
via { Data::Pipeline::Adapter -> new( source => to_IteratorSource( to_Iterator( $_ ) ) ) } |
165
|
|
|
|
|
|
|
; |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
coerce Aggregator, |
168
|
|
|
|
|
|
|
from CodeRef, |
169
|
|
|
|
|
|
|
via { $_ -> (); } |
170
|
|
|
|
|
|
|
; |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
1; |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
__END__ |