Globbing in grading is not critical
This commit is contained in:
parent
326ce94617
commit
6fa013ff14
2 changed files with 18 additions and 9 deletions
|
@ -290,6 +290,8 @@ use strict;
|
|||
use warnings;
|
||||
use Term::ANSIColor qw(:constants);
|
||||
|
||||
use ACU::Log;
|
||||
|
||||
sub new ($$$$$)
|
||||
{
|
||||
my $class = shift;
|
||||
|
@ -344,14 +346,20 @@ sub compute ($$$;$$$)
|
|||
|
||||
if (defined $ref)
|
||||
{
|
||||
my $glob = Tinyglob::tinyglob($ref);
|
||||
if ($glob ne $ref)
|
||||
{
|
||||
my $value = 0;
|
||||
for my $r (grep { /^$glob$/ } keys %$ids) {
|
||||
$value += $ids->{ $r };
|
||||
eval {
|
||||
my $glob = Tinyglob::tinyglob($ref);
|
||||
if ($glob ne $ref)
|
||||
{
|
||||
my $value = 0;
|
||||
for my $r (grep { /^$glob$/ } keys %$ids) {
|
||||
$value += $ids->{ $r };
|
||||
}
|
||||
$ids->{ $ref } = $value;
|
||||
}
|
||||
$ids->{ $ref } = $value;
|
||||
};
|
||||
if ($@) {
|
||||
my $err = $@;
|
||||
log ERROR, $@;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,8 @@ our @EXPORT = qw(tinyglob);
|
|||
|
||||
sub tinyglob
|
||||
{
|
||||
my @str = split("", quotemeta(shift));
|
||||
my $orig = shift;
|
||||
my @str = split("", quotemeta($orig));
|
||||
my $res = "";
|
||||
|
||||
my $metaescape = 0;
|
||||
|
@ -38,7 +39,7 @@ sub tinyglob
|
|||
$res .= '.*';
|
||||
}
|
||||
else {
|
||||
croak "Invalid number of \\";
|
||||
croak "Invalid number of \\ in '$orig'";
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
Reference in a new issue