open(FH,'>X') || die "Can't create x";
print FH "X";
-close(FH);
+close(FH) or die "Can't close: $!";
tie %dir, IO::Dir, $DIR;
my @files = keys %dir;
-#!./perl
+#!./perl
BEGIN {
chdir 't' if -d 't';
open F, "<$file" or die "Cannot open $file: $!\n" ;
my $line = 0;
while (<F>) {
- $line++;
+ $line++;
last if /^__END__/ ;
}
{
local $/ = undef;
- $files++;
+ $files++;
@prgs = (@prgs, $file, split "\n########\n", <F>) ;
}
close F ;
undef $/;
print "1..", scalar(@prgs)-$files, "\n";
-
-
+
+
for (@prgs){
unless (/\n/)
{
- print "# From $_\n";
- next;
+ print "# From $_\n";
+ next;
}
my $switch = "";
my @temps = () ;
if ( $prog =~ /--FILE--/) {
my(@files) = split(/\n--FILE--\s*([^\s\n]*)\s*\n/, $prog) ;
shift @files ;
- die "Internal error test $i didn't split into pairs, got " .
+ die "Internal error test $i didn't split into pairs, got " .
scalar(@files) . "[" . join("%%%%", @files) ."]\n"
if @files % 2 ;
while (@files > 2) {
push @temps, $filename ;
open F, ">$filename" or die "Cannot open $filename: $!\n" ;
print F $code ;
- close F ;
+ close F or die "Cannot close $filename: $!\n";
}
shift @files ;
$prog = shift @files ;
}
- open TEST, ">$tmpfile";
+ open TEST, ">$tmpfile" or die "Cannot open >$tmpfile: $!";
print TEST q{
- BEGIN {
- open(STDERR, ">&STDOUT")
+ BEGIN {
+ open(STDERR, ">&STDOUT")
or die "Can't dup STDOUT->STDERR: $!;";
}
};
print TEST "\n#line 1\n"; # So the line numbers don't get messed up.
print TEST $prog,"\n";
- close TEST;
+ close TEST or die "Cannot close $tmpfile: $!";
my $results = $Is_VMS ?
`./perl "-I../lib" $switch $tmpfile` :
$Is_MSWin32 ?
print "not ";
}
print "ok ", ++$i, "\n";
- foreach (@temps)
- { unlink $_ if $_ }
+ foreach (@temps)
+ { unlink $_ if $_ }
}
$i = 28;
open(FOO,">Cmd_subval.tmp");
print FOO "blah blah\n";
-close FOO;
+close FOO or die "Can't close Cmd_subval.tmp: $!";
&file_main(*F);
-close F;
+close F or die "Can't close: $!";
&info_main;
&file_package(*F);
-close F;
+close F or die "Can't close: $!";
&info_package;
unlink 'Cmd_subval.tmp';
sub file_main {
local(*F) = @_;
- open(F, 'Cmd_subval.tmp') || die "can't open\n";
+ open(F, 'Cmd_subval.tmp') || die "can't open: $!\n";
$i++;
eof F ? print "not ok $i\n" : print "ok $i\n";
}
sub info_main {
local(*F);
- open(F, 'Cmd_subval.tmp') || die "test: can't open\n";
+ open(F, 'Cmd_subval.tmp') || die "test: can't open: $!\n";
$i++;
eof F ? print "not ok $i\n" : print "ok $i\n";
&iseof(*F);
- close F;
+ close F or die "Can't close: $!";
}
sub iseof {
sub main'file_package {
local(*F) = @_;
- open(F, 'Cmd_subval.tmp') || die "can't open\n";
+ open(F, 'Cmd_subval.tmp') || die "can't open: $!\n";
$main'i++;
eof F ? print "not ok $main'i\n" : print "ok $main'i\n";
}
sub main'info_package {
local(*F);
- open(F, 'Cmd_subval.tmp') || die "can't open\n";
+ open(F, 'Cmd_subval.tmp') || die "can't open: $!\n";
$main'i++;
eof F ? print "not ok $main'i\n" : print "ok $main'i\n";
&iseof(*F);
close OUT;
EOF
;
-close PROG;
+close PROG or die "close ff-prog: $!";;
push @delete, "ff-prog";
$| = 0; # we want buffered output
my $command = qq{$runperl "ff-prog" "$f" "rl"};
open OUT, "> $f" or die "open $f: $!";
print OUT "Pe";
- close OUT;
+ close OUT or die "close $f: $!";;
print "# $command\n";
$code->($command);
print file_eq($f, "Perl") ? "ok $t\n" : "not ok $t\n";