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. In reply to Filehandle open or not - WTF? :(
by Rhodium
For:
Use:
& & < < > > [ [ ] ]