lib/Shell/Amazon/S3/CommandDispatcher.pm

filter: Statementstmt 55.5% 15 / 27 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 4 / 6 Podpod 0.0% 0 / 1 totaltotal 52.7% 19 / 36 SCAR 13.9
CC
3
Cov
52%
__ANON__
6.0
dispatch
6.0
BEGIN
1.0
CRAP 4.0
« lib/Shell/Amazon/S3/CommandWithBucket.pm ↑ Summary lib/Shell/Amazon/S3/Command/bucket.pm »
1 package Shell::Amazon::S3::CommandDispatcher;
2 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use Module::Pluggable::Object;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Class::MOP;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Shell::Amazon::S3::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 has 'dispatch_table' => (
8 is => 'ro',
9 isa => 'HashRef',
10 required => 1,
11 default => sub {
12 0 ▶ my $finder = Module::Pluggable::Object->new(
Subroutine __ANON__: not called CC=2 SCAR=17.9
13 search_path => 'Shell::Amazon::S3::Command', );
14 0 my @commands = $finder->plugins;
15 0 Class::MOP::load_class($_) for @commands;
16 my %table
17 0 = map { Shell::Amazon::S3::Utils->classsuffix($_) => $_->new }
18 @commands;
19 0 \%table;
20 }
21 1 );
22  
23 sub dispatch {
24 0 ▶ my ( $self, $command, $args ) = @_;
Subroutine dispatch: not called CC=2 SCAR=17.9
Pod undocumented
25 0 my $result;
26 0 ▶ if ( exists $self->dispatch_table->{$command} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->dispatch_table->{$command}) { } 0 0 0
27 0 $result = $self->dispatch_table->{$command}->do_execute($args);
28 }
29 else {
30 0 $result = 'Unknown command:' . $command;
31 }
32 0 $result;
33 }
34  
35 1 __PACKAGE__->meta->make_immutable;
36  
37 1 1;
« lib/Shell/Amazon/S3/CommandWithBucket.pm ↑ Summary lib/Shell/Amazon/S3/Command/bucket.pm »