From: Mischa POSLAWSKY Date: Tue, 23 Jun 2015 14:08:18 +0000 (+0200) Subject: keyboard: avoid warning for empty mode parameter X-Git-Tag: v1.8~58 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/ec70841119a49ebeed4e14ce682f29d15e1ed27d keyboard: avoid warning for empty mode parameter Empty string splits to an empty list, resulting in a benign warning: > Odd number of elements in hash assignment --- diff --git a/Shiar_Sheet/Keyboard.pm b/Shiar_Sheet/Keyboard.pm index 90ec4e8..2b3cc86 100644 --- a/Shiar_Sheet/Keyboard.pm +++ b/Shiar_Sheet/Keyboard.pm @@ -126,7 +126,7 @@ sub print_key { sub print_rows { my $self = shift; my %moderows = ( - -DEFAULT => !@_ ? '' : split(/(?:\s*([^=\s]*)=\s*)/, shift), + -DEFAULT => !!@_ && $_[0] ne '' && split(/(?:\s*([^=\s]*)=\s*)/, shift), # plus specific mode overrides prefixed by '=' ); my $defrows = shift || [2, 1, 0];