| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Articulate::Role::Flow; | 
| 2 | 3 |  |  | 3 |  | 1320 | use strict; | 
|  | 3 |  |  |  |  | 6 |  | 
|  | 3 |  |  |  |  | 117 |  | 
| 3 | 3 |  |  | 3 |  | 13 | use warnings; | 
|  | 3 |  |  |  |  | 3 |  | 
|  | 3 |  |  |  |  | 67 |  | 
| 4 | 3 |  |  | 3 |  | 11 | use Moo::Role; | 
|  | 3 |  |  |  |  | 3 |  | 
|  | 3 |  |  |  |  | 19 |  | 
| 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 | 58 | my $self = shift; | 
| 55 | 12 |  |  |  |  | 32 | $self->process_method( augment => @_ ); | 
| 56 |  |  |  |  |  |  | } | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | sub _delegate { | 
| 59 | 6 |  |  | 6 |  | 30 | my ( $self, $method, $providers, $args ) = @_; | 
| 60 | 6 |  |  |  |  | 12 | foreach my $provider (@$providers) { | 
| 61 | 6 |  |  |  |  | 19 | my $result = $provider->$method(@$args); | 
| 62 | 6 | 50 |  |  |  | 1828 | return $result unless defined $result; | 
| 63 |  |  |  |  |  |  | } | 
| 64 | 6 |  |  |  |  | 46 | return $args->[0]; | 
| 65 |  |  |  |  |  |  | } | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | 1; |