| 1 | package Patterns::ChainOfResponsibility::Provider; | ||||||||||
| 2 | |||||||||||
| 3 | 3 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 3 | with 'Patterns::ChainOfResponsibility::Role::Dispatcher'; | |||||||||
| 5 | |||||||||||
| 6 | 12 | ▶ | sub dispatch { | ||||||||
|
Subroutine
dispatch: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||
| 7 | 12 | my ($self, $current_handler, $return, $args) = @_; | |||||||||
| 8 | 12 | ▶ | if(@$return) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 9 | 6 | return @$return; | |||||||||
| 10 | } else { | ||||||||||
| 11 | 6 | ▶ | if($current_handler->no_handlers) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 12 | 0 | return; | |||||||||
| 13 | } else { | ||||||||||
| 14 | 6 | return $self->next_handler($current_handler, @$args); | |||||||||
| 15 | } | ||||||||||
| 16 | } | ||||||||||
| 17 | } | ||||||||||
| 18 | |||||||||||
| 19 | =head1 NAME | ||||||||||
| 20 | |||||||||||
| 21 | Patterns::ChainOfResponsibility::Provider - The Provider Dispatch Strategy | ||||||||||
| 22 | |||||||||||
| 23 | =head1 DESCRIPTION | ||||||||||
| 24 | |||||||||||
| 25 | Dispatch @args to each Handler in turn until we find one that processes them. | ||||||||||
| 26 | This is probably the most classic "CoR" behavior. | ||||||||||
| 27 | |||||||||||
| 28 | You won't use this class directly. | ||||||||||
| 29 | Please see L<Patterns::ChainOfResponsibility::Role::Handler> | ||||||||||
| 30 | |||||||||||
| 31 | =head1 AUTHOR | ||||||||||
| 32 | |||||||||||
| 33 | John Napiorkowski C<< <jjnapiork@cpan.org> >> | ||||||||||
| 34 | |||||||||||
| 35 | =head1 LICENSE & COPYRIGHT | ||||||||||
| 36 | |||||||||||
| 37 | Copyright 2011, John Napiorkowski C<< <jjnapiork@cpan.org> >> | ||||||||||
| 38 | |||||||||||
| 39 | This program is free software; you can redistribute it and/or modify | ||||||||||
| 40 | it under the same terms as Perl itself. | ||||||||||
| 41 | |||||||||||
| 42 | =cut | ||||||||||
| 43 | |||||||||||
| 44 | 3 | 1; | |||||||||