develooper Front page | perl.perl5.porters | Postings from December 2001

[PATCH] improve error reporting

From:
andreas.koenig
Date:
December 27, 2001 01:00
Subject:
[PATCH] improve error reporting
Message ID:
m3adw5gi00.fsf@anima.de
--- /usr/sources/perl/repoperls/perl-5.7.2@13899/t/cmd/subval.t	Mon Jul  9 16:11:21 2001
+++ perl-5.7.2@13899/t/cmd/subval.t	Thu Dec 27 09:53:08 2001
@@ -114,14 +114,14 @@
 $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';
@@ -129,7 +129,7 @@
 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";
 }
@@ -137,11 +137,11 @@
 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 {
@@ -156,7 +156,7 @@
  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";
  }
@@ -164,7 +164,7 @@
  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);

-- 
andreas



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About