File Coverage

blib/lib/MooX/Cmd/Role/AbbrevCmds.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1             package MooX::Cmd::Role::AbbrevCmds;
2             # ABSTRACT: Text::Abbrev support role for MooX::Cmd
3             our $VERSION = '1.000';
4 2     2   1627 use strict;
  2         7  
  2         87  
5 2     2   11 use warnings;
  2         3  
  2         132  
6              
7 2     2   15 use Text::Abbrev;
  2         4  
  2         165  
8              
9 2     2   31 use Moo::Role;
  2         5  
  2         30  
10              
11              
12             requires "command_commands";
13              
14             around _build_command_commands => sub {
15             my $next = shift;
16             my $class = shift;
17             my $params = shift;
18             my $cmd_cmds = $class->$next($params, @_);
19              
20             my %abbrevs = abbrev keys %$cmd_cmds;
21             my %cmd_cmds = map { $_ => $cmd_cmds->{$abbrevs{$_}} } keys %abbrevs;
22              
23             return \%cmd_cmds;
24             };
25              
26             1;
27              
28             __END__