From ff91f93ab2e588f2c3ce248b8f61dd80cdf96821 Mon Sep 17 00:00:00 2001 From: etienne Date: Tue, 27 Nov 2001 11:11:12 +0000 Subject: *** empty log message *** --- src/ivymon | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/ivymon b/src/ivymon index b94444d..1e32d3a 100755 --- a/src/ivymon +++ b/src/ivymon @@ -1357,7 +1357,10 @@ sub loadfile { ); return unless $file; # open file - open(IN, "$file") or $mw->Tk::Error("$!\n"); + unless (open(IN, "$file")) { + $mw->Tk::Error("$!\n"); + return; + } my %client; my $step = 0; my $line = 0; @@ -1405,21 +1408,31 @@ sub savefile { ['All Files', '*']], ); return unless $file; + my $status = 0; # open file - open(OUT, ">$file") or $mw->Tk::Error("$!\n"); - + unless (open(OUT, ">$file")) { + $mw->Tk::Error("$!\n"); + return; + } # save connected applications name my @clients = $clientsListbox->get(0, 'end'); - print OUT "applications=", join(',', @clients),"\n" or $mw->Tk::Error("$!\n"); + unless (print OUT "applications=", join(',', @clients),"\n") { + $mw->Tk::Error("$!\n"); + close(OUT); + return; + } - my $nblines = $messagesText->index("end"); $nblines =~ s/\.\d+$//; $nblines--; $progressbar->configure(-to => $nblines); my $step = int($nblines/10); #print "step=$step\n"; - print OUT "messages_number=$nblines\n" or $mw->Tk::Error("$!\n"); + unless (print OUT "messages_number=$nblines\n") { + $mw->Tk::Error("$!\n"); + close(OUT); + return; + } # save messages 100 by 100, in order to reduce memory usage my $index = "1.0"; my $counter = 0; @@ -1431,7 +1444,11 @@ sub savefile { $progressbar->update; last; } - print OUT $messages or $mw->Tk::Error("$!\n"); + unless (print OUT $messages) { + $mw->Tk::Error("$!\n"); + close(OUT); + return; + } $progressbar->value($counter); $counter += 100; $progressbar->update if ($step == 0 or $counter % $step == 0); -- cgit v1.1