MenuGrinder/Plugin/Hotkey.pm untested

filter: Statementstmt 0.0% 0 / 15 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 27 CC 4 SCAR 25.1
CC
4
Cov
0%
item_mogrify
20.0
BEGIN
2.0
BEGIN
2.0
CRAP 12.3
1 package WWW::MenuGrinder::Plugin::Hotkey;
2 BEGIN {
3 $WWW::MenuGrinder::Plugin::Hotkey::VERSION = '0.06';
4 }
5  
6 # ABSTRACT: WWW::MenuGrinder plugin that generates hotkeys from labels.
7  
8 use Moose;
9  
10 with 'WWW::MenuGrinder::Role::ItemMogrifier';
11  
12 sub item_mogrify {
13 my ($self, $item) = @_;
14  
15 return $item unless exists $item->{label};
16  
17 if ($item->{label} =~ s#_(.)#<u>$1</u>#) {
18 $item->{hotkey} = uc $1 unless defined $item->{hotkey};
19 }
20  
21 return $item;
22 }
23  
24 __PACKAGE__->meta->make_immutable;
25  
26 no Moose;
27 1;
28  
29  
30 __END__