X-Git-Url: http://git.shiar.net/sheet.git/blobdiff_plain/e04254be9c83d0db501eb8592517fc7e30ba15ad..d9d251ca5b512130cfb4cb9a3e03aa6748f67526:/Shiar_Sheet/Keyboard.pm?ds=sidebyside diff --git a/Shiar_Sheet/Keyboard.pm b/Shiar_Sheet/Keyboard.pm index 8f436a6..aecd0bc 100644 --- a/Shiar_Sheet/Keyboard.pm +++ b/Shiar_Sheet/Keyboard.pm @@ -5,7 +5,7 @@ use warnings; no warnings 'uninitialized'; # save some useless checks for more legible code use Carp; -our $VERSION = 'v2.02'; +our $VERSION = 'v2.03'; my @casedesc = (undef, qw/shift ctrl meta/, 'shift meta'); my @rowdesc = qw(numeric top home bottom); @@ -29,13 +29,11 @@ sub new { croak 'No key definitions specified' unless ref $self->{def} eq 'HASH'; $self->{map} ||= 'qwerty'; - my $parent = (caller)[0]; # calling module - my $sign = do { - no strict 'refs'; # temporarily allow variable references - \%{ $parent.'::sign' }; # return %sign from parent + $self->{sign} ||= do { + require Shiar_Sheet::KeySigns; + Shiar_Sheet::KeySigns->VERSION(1.03); + \%Shiar_Sheet::KeySigns::sign; }; - croak "%${parent}::sign not found" unless %$sign; - $self->{sign} = $sign; bless $self, $class; } @@ -94,7 +92,7 @@ sub print_key { } my ($flags, $desc, $mnem) = @{$flags}; if (my $txt = $self->{key}->{$mode.$key}) { - ($desc, $mnem) = @{$txt}; + ($desc, $mnem) = split /\n/, $txt; } # $key = $keytrans{$key} if defined $keytrans{$key}; @@ -113,7 +111,7 @@ sub print_key { ); $flags .= ' chr'.ord(substr $key, -1) if $key ne '^0'; - print qq{\t\t
%s: %s | ', # XXX insert here to fix msie<=6 $self->{mode}->{$mode} || "mode $basemode", "$rowdesc[$row] row $casedesc[$case]" ) unless $row < 0; print "\n"; - my $caseclass = 'keys'; - $caseclass .= ' lead' if defined $modekeys->{lead}; # leading command key shown - $caseclass .= " $casedesc[$case]" if defined $casedesc[$case]; - print qq{\t\t
---|