modified loadtest() to produce better error message when it fails to load

a test file
This commit is contained in:
Daniel Stenberg 2004-02-26 09:19:16 +00:00
parent 0c3c1b390a
commit 0c03ed6013
1 changed files with 12 additions and 13 deletions

View File

@ -92,21 +92,20 @@ sub getpart {
sub loadtest { sub loadtest {
my ($file)=@_; my ($file)=@_;
my $dir;
$dir = $ENV{'srcdir'};
if(!$dir) {
$dir=".";
}
undef @xml; undef @xml;
open(XML, "<$dir/$file") ||
return 1; # failure! if(open(XML, "<$file")) {
binmode XML; # for crapage systems, use binary binmode XML; # for crapage systems, use binary
while(<XML>) { while(<XML>) {
push @xml, $_; push @xml, $_;
}
close(XML);
}
else {
# failure
print STDERR "file $file wouldn't open!\n";
return 1;
} }
close(XML);
return 0; return 0;
} }