line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Articulate::Role::Flow; |
2
|
3
|
|
|
3
|
|
1390
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
104
|
|
3
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
77
|
|
4
|
3
|
|
|
3
|
|
11
|
use Moo::Role; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
20
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Articulate::Role::Flow - methods |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 DESCRIPTION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
This is a helper class for flow roles. All consumers of this role must have a C method which can be called as follows: |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
$self->process_method( $methodname, $item, $request ); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
This role provides a method C<_delegate> which can be used to delegate to other providers. It is called as: |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
$self->_delegate( $method, $providers, $args ) |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
where C<$providers> and C<$args> are arrayrefs. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 METHODS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=cut |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head3 enrich |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
$self->enrich($item); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Does |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
$self->process_method( enrich => $item ); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub enrich { |
39
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
40
|
0
|
|
|
|
|
0
|
$self->process_method( enrich => @_ ); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head3 augment |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
$self->augment($item); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Does |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
$self->process_method( augment => $item ); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=cut |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub augment { |
54
|
12
|
|
|
12
|
1
|
62
|
my $self = shift; |
55
|
12
|
|
|
|
|
37
|
$self->process_method( augment => @_ ); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub _delegate { |
59
|
6
|
|
|
6
|
|
28
|
my ( $self, $method, $providers, $args ) = @_; |
60
|
6
|
|
|
|
|
10
|
foreach my $provider (@$providers) { |
61
|
6
|
|
|
|
|
20
|
my $result = $provider->$method(@$args); |
62
|
6
|
50
|
|
|
|
2288
|
return $result unless defined $result; |
63
|
|
|
|
|
|
|
} |
64
|
6
|
|
|
|
|
56
|
return $args->[0]; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |