Skip to content

Commit 5746e15

Browse files
made the script work when the full path to the script is not provided
1 parent 70f4542 commit 5746e15

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

scorer.pl

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
#!/usr/bin/perl
22

33
BEGIN {
4-
$d = $0;
5-
$d =~ s/\/[^\/][^\/]*$//g;
6-
unshift(@INC, $d."/lib");
4+
$d = $0;
5+
$d =~ s/\/[^\/][^\/]*$//g;
6+
7+
if ($d eq $0) {
8+
unshift(@INC, "lib");
9+
}
10+
else {
11+
unshift(@INC, $d . "/lib");
12+
}
713
}
814

915
use strict;
1016
use CorScorer;
1117

12-
1318
if (@ARGV < 3) {
1419
print q|
1520
use: scorer.pl <metric> <keys_file> <response_file> [name]
@@ -35,20 +40,19 @@ BEGIN
3540
exit;
3641
}
3742

38-
my $metric = shift (@ARGV);
43+
my $metric = shift(@ARGV);
3944
if ($metric !~ /^(muc|bcub|ceafm|ceafe|blanc|all)/i) {
4045
print "Invalid metric\n";
4146
exit;
4247
}
4348

44-
4549
if ($metric eq 'all') {
4650
foreach my $m ('muc', 'bcub', 'ceafm', 'ceafe', 'blanc') {
4751
print "\nMETRIC $m:\n";
48-
&CorScorer::Score( $m, @ARGV );
52+
&CorScorer::Score($m, @ARGV);
4953
}
5054
}
5155
else {
52-
&CorScorer::Score( $metric, @ARGV );
56+
&CorScorer::Score($metric, @ARGV);
5357
}
5458

0 commit comments

Comments
 (0)