diff options
author | etienne | 2001-11-27 11:11:12 +0000 |
---|---|---|
committer | etienne | 2001-11-27 11:11:12 +0000 |
commit | ff91f93ab2e588f2c3ce248b8f61dd80cdf96821 (patch) | |
tree | d2dc16f1339babc0c30694f8773fc31d42843627 | |
parent | 32823060be15356cd5cd88a591659d8a46c71208 (diff) | |
download | ivymon-ff91f93ab2e588f2c3ce248b8f61dd80cdf96821.zip ivymon-ff91f93ab2e588f2c3ce248b8f61dd80cdf96821.tar.gz ivymon-ff91f93ab2e588f2c3ce248b8f61dd80cdf96821.tar.bz2 ivymon-ff91f93ab2e588f2c3ce248b8f61dd80cdf96821.tar.xz |
*** empty log message ***
-rwxr-xr-x | src/ivymon | 31 |
1 files changed, 24 insertions, 7 deletions
@@ -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); |