Skip to content

Commit

Permalink
corpus.t: use 3-arg open and lexical filehandles
Browse files Browse the repository at this point in the history
  • Loading branch information
mauke authored and khwilliamson committed Jun 29, 2024
1 parent 9b7d368 commit b171dec
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions t/corpus.t
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ BEGIN {
my $corpusdir = File::Spec->catdir(File::Basename::dirname(Cwd::abs_path(__FILE__)), 'corpus');
diag "Corpusdir: $corpusdir";

opendir(INDIR, $corpusdir) or die "Can't opendir corpusdir : $!";
my @f = map File::Spec::->catfile($corpusdir, $_), readdir(INDIR);
closedir(INDIR);
opendir(my $indir, $corpusdir) or die "Can't opendir $corpusdir : $!";
my @f = map File::Spec::->catfile($corpusdir, $_), readdir($indir);
closedir($indir);
my %f;
@f{@f} = ();
foreach my $maybetest (sort @f) {
Expand Down Expand Up @@ -92,22 +92,22 @@ foreach my $f (@testfiles) {

my $outfilename = ($HACK > 1) ? $wouldxml{$f} : "$wouldxml{$f}\_out";
if($HACK) {
open OUT, ">$outfilename" or die "Can't write-open $outfilename: $!\n";
binmode(OUT);
print OUT $outstring;
close(OUT);
open my $out, ">", $outfilename or die "Can't write-open $outfilename: $!\n";
binmode($out);
print $out $outstring;
close($out);
}
unless($xml) {
diag " (no comparison done)";
ok 1;
next;
}

open(IN, "<$xml") or die "Can't read-open $xml: $!";
open(my $in, "<", $xml) or die "Can't read-open $xml: $!";
#binmode(IN);
local $/;
my $xmlsource = <IN>;
close(IN);
my $xmlsource = <$in>;
close($in);

diag "There's errata!" if $outstring =~ m/start_line="-321"/;

Expand Down

0 comments on commit b171dec

Please sign in to comment.