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
parent 326ce94617
commit 6fa013ff14
2 changed files with 18 additions and 9 deletions

View file

@ -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, $@;
}
}

View file

@ -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 {