Role/Dispatcher.pm

filter: Statementstmt 100% 9 / 9 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod 0.0% 0 / 1 totaltotal 92.8% 13 / 14 CC 2 SCAR 5.1
CC
2
Cov
100%
next_handler
2.0
BEGIN
1.0
CRAP 1.7
« Provider.pm ↑ Summary Role/Handler.pm »
1 package Patterns::ChainOfResponsibility::Role::Dispatcher;
2  
3 5 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 requires 'dispatch';
5  
6 14 ▶sub next_handler {
Subroutine next_handler: called CC=2 SCAR=6.9
Pod undocumented
7 14 my ($self, $current_handler, @args) = @_;
8 14 my ($next, @remaining) = $current_handler->all_handlers;
9 14 ▶ $next->next_handlers(@remaining) if @remaining;
Branch: 1 branch
BranchTrueFalseTotal
if @remaining 8 6 14
10 14 return $next->process(@args);
11 }
12  
13 =head1 NAME
14
15 Patterns::ChainOfResponsibility::Role::Dispatcher - The Dispatcher Role
16
17 =head1 DESCRIPTION
18  
19 Basically a command style class that figure out the strategy for dispatching
20 arguments to each handler in the chain
21  
22 =head1 METHODS
23  
24 This role defines the following methods
25  
26 =head2 dispatch ( $return, $args)
27  
28 Gets arrayrefs of the last return from a handler and the initial arguments sent
29 to process and figure out what to do.
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 5 1;
« Provider.pm ↑ Summary Role/Handler.pm »