| 1 | package MooX::Cmd::Role::AbbrevCmds; | ||
| 2 | |||
| 3 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 2 | our $VERSION = "0.016_001"; | |
| 7 | |||
| 8 | 2 | ▶ | use Text::Abbrev; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 2 | ▶ | use Moo::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | =head1 NAME | ||
| 13 | |||
| 14 | MooX::Cmd::Role::AbbrevCmds - Text::Abbrev support role for MooX::Cmd | ||
| 15 | |||
| 16 | =cut | ||
| 17 | |||
| 18 | 2 | requires "command_commands"; | |
| 19 | |||
| 20 | around _build_command_commands => sub { | ||
| 21 | 6 | ▶ | my $next = shift; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 22 | 6 | my $class = shift; | |
| 23 | 6 | my $params = shift; | |
| 24 | 6 | my $cmd_cmds = $class->$next($params, @_); | |
| 25 | |||
| 26 | 6 | my %abbrevs = abbrev keys %$cmd_cmds; | |
| 27 | 6 | my %cmd_cmds = map { $_ => $cmd_cmds->{$abbrevs{$_}} } keys %abbrevs; | |
| 28 | |||
| 29 | 6 | return \%cmd_cmds; | |
| 30 | 2 | }; | |
| 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<http://dev.perl.org/licenses/> for more information. | ||
| 41 | |||
| 42 | =cut | ||
| 43 | |||
| 44 | 2 | 1; | |
| 45 | |||