Rhodium has asked for the wisdom of the Perl Monks concerning the following question:
readline() on closed filehandle main::LOG at ./netlist.pl line 510.
Ok fine, I thought it was re-opening the thing so many times, it barfed. That's ok, just check the file everyonce in a while. So I started looking to see if fileno was defined. It NEVER get's defined. Can someone please point me in the right direction..my $log = "$cell".".$$"."/si.log"; my $pwd = cwd(); my $netlist = "$pwd"."/"."$cell".".$$"."/"."$cell".".cdl"; my ($error, $done) = 0; print " Checking log files for success on $netlist\n"; while (( ! $error ) and ( ! -f $netlist)) { open ( LOG, $log ) || warn " Couldn't open log\n" if ($debug); while (<LOG> ){ print "$_"; if ( ($_ =~ m/error/i) or ($_ =~ m/warning/i) ){ print "$_" ; print "$_" if ($debug) ; if ($_ =~ m/error/i) { $error = 1; print "$_"; $icfb->hard_close(); } } close LOG; } sleep 2; }
FWIW, I also tried to use File::Tail but I couldn't figure out how to do a conditional if no errors and no netlist keep going..my $log = "$cell".".$$"."/si.log"; my $pwd = cwd(); my $netlist = "$pwd"."/"."$cell".".$$"."/"."$cell".".cdl"; my ($error, $done) = 0; print " Checking log files for success on $netlist\n"; while (( ! $error ) and ( ! -f $netlist)) { open ( LOG, $log ) || warn " Couldn't open log\n" if ($debug); if ( defined (fileno LOG )) { print "Defined \n"; while (<LOG> ){ print "$_"; if ( ($_ =~ m/error/i) or ($_ =~ m/warning/i) ){ print "$_" ; print "$_" if ($debug) ; if ($_ =~ m/error/i) { $error = 1; print "$_"; $icfb->hard_close(); } } } close LOG; } else { print "Not Defined\n"; } sleep 2; }
The seeker of perl wisdom.
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Filehandle open or not - WTF? :(
by Ovid (Cardinal) on Mar 11, 2003 at 22:42 UTC | |
by Rhodium (Scribe) on Mar 11, 2003 at 23:20 UTC | |
by IlyaM (Parson) on Mar 11, 2003 at 23:42 UTC | |
by Aristotle (Chancellor) on Mar 15, 2003 at 12:59 UTC | |
|
Re: Filehandle open or not - WTF? :(
by chromatic (Archbishop) on Mar 11, 2003 at 22:44 UTC | |
|
Re: Filehandle open or not - WTF? :(
by Nkuvu (Priest) on Mar 11, 2003 at 23:56 UTC | |
by clairudjinn (Beadle) on Mar 12, 2003 at 07:06 UTC | |
by Nkuvu (Priest) on Mar 12, 2003 at 15:25 UTC | |
|
Re: Filehandle open or not - WTF? :(
by data64 (Chaplain) on Mar 11, 2003 at 22:22 UTC |