Archived
1
0
Fork 0

Globbing in grading is not critical

This commit is contained in:
Mercier Pierre-Olivier 2013-09-30 13:08:33 +02:00
commit 6fa013ff14
2 changed files with 18 additions and 9 deletions

View file

@ -290,6 +290,8 @@ use strict;
use warnings; use warnings;
use Term::ANSIColor qw(:constants); use Term::ANSIColor qw(:constants);
use ACU::Log;
sub new ($$$$$) sub new ($$$$$)
{ {
my $class = shift; my $class = shift;
@ -344,14 +346,20 @@ sub compute ($$$;$$$)
if (defined $ref) if (defined $ref)
{ {
my $glob = Tinyglob::tinyglob($ref); eval {
if ($glob ne $ref) my $glob = Tinyglob::tinyglob($ref);
{ if ($glob ne $ref)
my $value = 0; {
for my $r (grep { /^$glob$/ } keys %$ids) { my $value = 0;
$value += $ids->{ $r }; for my $r (grep { /^$glob$/ } keys %$ids) {
$value += $ids->{ $r };
}
$ids->{ $ref } = $value;
} }
$ids->{ $ref } = $value; };
if ($@) {
my $err = $@;
log ERROR, $@;
} }
} }

View file

@ -12,7 +12,8 @@ our @EXPORT = qw(tinyglob);
sub tinyglob sub tinyglob
{ {
my @str = split("", quotemeta(shift)); my $orig = shift;
my @str = split("", quotemeta($orig));
my $res = ""; my $res = "";
my $metaescape = 0; my $metaescape = 0;
@ -38,7 +39,7 @@ sub tinyglob
$res .= '.*'; $res .= '.*';
} }
else { else {
croak "Invalid number of \\"; croak "Invalid number of \\ in '$orig'";
} }
} }
else { else {