| 1 | package Patterns::ChainOfResponsibility::Broadcast; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | with 'Patterns::ChainOfResponsibility::Role::Dispatcher'; | |||||||||
| 5 | |||||||||||
| 6 | 3 | ▶ | sub dispatch { | ||||||||
|
Subroutine
dispatch: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||
| 7 | 3 | my ($self, $current_handler, $return, $args) = @_; | |||||||||
| 8 | 3 | ▶ | if(@$return) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 9 | 3 | ▶ | if($current_handler->no_handlers) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 10 | 1 | return 1; | |||||||||
| 11 | } else { | ||||||||||
| 12 | 2 | return $self->next_handler($current_handler, @$args); | |||||||||
| 13 | } | ||||||||||
| 14 | } else { | ||||||||||
| 15 | 0 | return; | |||||||||
| 16 | } | ||||||||||
| 17 | } | ||||||||||
| 18 | |||||||||||
| 19 | =head1 NAME | ||||||||||
| 20 | |||||||||||
| 21 | Patterns::ChainOfResponsibility::Broadcast - The Broadcast Dispatch Strategy | ||||||||||
| 22 | |||||||||||
| 23 | =head1 DESCRIPTION | ||||||||||
| 24 | |||||||||||
| 25 | Dispatch @args to each Handler in turn until we have processed each handler | ||||||||||
| 26 | Use this when you want to pass the same args to a bunch of handlers and don't | ||||||||||
| 27 | care about what happens to them. A possible example would be a bunch of | ||||||||||
| 28 | loggers that log events differently but independently. | ||||||||||
| 29 | |||||||||||
| 30 | You won't use this class directly. | ||||||||||
| 31 | Please see L<Patterns::ChainOfResponsibility::Role::Handler> | ||||||||||
| 32 | |||||||||||
| 33 | =head1 AUTHOR | ||||||||||
| 34 | |||||||||||
| 35 | John Napiorkowski C<< <jjnapiork@cpan.org> >> | ||||||||||
| 36 | |||||||||||
| 37 | =head1 LICENSE & COPYRIGHT | ||||||||||
| 38 | |||||||||||
| 39 | Copyright 2011, John Napiorkowski C<< <jjnapiork@cpan.org> >> | ||||||||||
| 40 | |||||||||||
| 41 | This program is free software; you can redistribute it and/or modify | ||||||||||
| 42 | it under the same terms as Perl itself. | ||||||||||
| 43 | |||||||||||
| 44 | =cut | ||||||||||
| 45 | |||||||||||
| 46 | 2 | 1; | |||||||||