Options.pm (PDL-2.076) | : | Options.pm (PDL-2.077) | ||
---|---|---|---|---|
skipping to change at line 781 | skipping to change at line 781 | |||
sub translate { | sub translate { | |||
my $self = shift; | my $self = shift; | |||
my %trans = %{$self->translation}; | my %trans = %{$self->translation}; | |||
my %opt = %{$self->curr_full}; # Process all options | my %opt = %{$self->curr_full}; # Process all options | |||
# Now need to go through each of the keys | # Now need to go through each of the keys | |||
# and if the corresponding key exists in the translation | # and if the corresponding key exists in the translation | |||
# hash we need to check that a valid translation exists | # hash we need to check that a valid translation exists | |||
foreach my $key ( sort keys %opt ) { | foreach my $key ( sort grep defined $opt{$_}, keys %opt ) { | |||
if (exists $trans{$key}) { | if (exists $trans{$key}) { | |||
# Okay so a translation might exist | # Okay so a translation might exist | |||
# Now compare keys in the hash in the hash | # Now compare keys in the hash in the hash | |||
my %subhash = %{$trans{$key}}; | my %subhash = %{$trans{$key}}; | |||
my @matched = | my @matched = | |||
$self->compare_with_list(1, $opt{$key}, sort keys %subhash); | $self->compare_with_list(1, $opt{$key}, sort keys %subhash); | |||
# At this point we have matched the userkey to a key in the | # At this point we have matched the userkey to a key in the | |||
# dictionary. If there is no translation dont say anything | # dictionary. If there is no translation dont say anything | |||
skipping to change at line 838 | skipping to change at line 838 | |||
# Returns: Array of all keys that match $key taking into account the | # Returns: Array of all keys that match $key taking into account the | |||
# object state. | # object state. | |||
# | # | |||
# There must be a more compact way of doing this | # There must be a more compact way of doing this | |||
sub compare_with_list { | sub compare_with_list { | |||
my $self = shift; | my $self = shift; | |||
my $flag = shift; | my $flag = shift; | |||
my $key = shift; | my $key = shift; | |||
confess "Called with undefined key" if !defined $key; | ||||
my @list = @_; | my @list = @_; | |||
my @result = (); | my @result = (); | |||
my ($casesens, $minmatch); | my ($casesens, $minmatch); | |||
if ($flag == 0) { | if ($flag == 0) { | |||
$casesens = $self->casesens; | $casesens = $self->casesens; | |||
$minmatch = $self->minmatch; | $minmatch = $self->minmatch; | |||
} else { | } else { | |||
$casesens = $self->casesenstrans; | $casesens = $self->casesenstrans; | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added |