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              
3 2     2   1018 use strict;
  2         4  
  2         53  
4 2     2   10 use warnings;
  2         4  
  2         75  
5              
6             our $VERSION = "0.016_001";
7              
8 2     2   9 use Text::Abbrev;
  2         4  
  2         99  
9              
10 2     2   9 use Moo::Role;
  2         4  
  2         12  
11              
12             =head1 NAME
13              
14             MooX::Cmd::Role::AbbrevCmds - Text::Abbrev support role for MooX::Cmd
15              
16             =cut
17              
18             requires "command_commands";
19              
20             around _build_command_commands => sub {
21             my $next = shift;
22             my $class = shift;
23             my $params = shift;
24             my $cmd_cmds = $class->$next($params, @_);
25              
26             my %abbrevs = abbrev keys %$cmd_cmds;
27             my %cmd_cmds = map { $_ => $cmd_cmds->{$abbrevs{$_}} } keys %abbrevs;
28              
29             return \%cmd_cmds;
30             };
31              
32             =head1 LICENSE AND COPYRIGHT
33              
34             Copyright 2017 Jens Rehsack.
35              
36             This program is free software; you can redistribute it and/or modify it
37             under the terms of either: the GNU General Public License as published
38             by the Free Software Foundation; or the Artistic License.
39              
40             See L for more information.
41              
42             =cut
43              
44             1;
45