keyboard: avoid warning for empty mode parameter
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 23 Jun 2015 14:08:18 +0000 (16:08 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 21 Sep 2015 22:20:08 +0000 (00:20 +0200)
Empty string splits to an empty list, resulting in a benign warning:
> Odd number of elements in hash assignment

Shiar_Sheet/Keyboard.pm

index 90ec4e827daee68cc9279315a470de17719b0d73..2b3cc8629e8033d0d818dfd008b6e7efafb16418 100644 (file)
@@ -126,7 +126,7 @@ sub print_key {
 sub print_rows {
        my $self = shift;
        my %moderows = (
 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];
                # plus specific mode overrides prefixed by '='
        );
        my $defrows = shift || [2, 1, 0];