in reply to Filehandler Trouble

Can you please explain what you mean by "doesn't work"? Are you getting an error message? Maybe you should check the return value from print() and close(). Also, can you show us the open() call for LOG?

-sam

Replies are listed 'Best First'.
Re^2: Filehandler Trouble
by tc1364 (Beadle) on Dec 14, 2004 at 21:36 UTC
    Sorry about getting back so late it is getting busier over here. The message doesn't get printed into the eadas.log file by the filehandler LOG. This was puzzling me because my other messages are being printed into the eadas.log file by the filehandler OK. There are no error messages being reported. What would be the best way to check the return values for the calls you mention and so that they can be checked?
    open(LOG, ">> $log/eadas.log") or die "Can't open $log/eadas.log: $!\n +"; LOG->autoflush(1);
      Try this:

      print LOG "foo" or die "Unable to print: $!"; close LOG or die "Unable to close: $!";

      -sam

        Both lines were added and there were no errors being reported but the "foo" didn't get printed into the log file. The last verbage that gets printed is in the below foreach loop. After this section of code it starts making an Excel spreadsheet.
        upd_hash(\%ca, \@ca); upd_hash(\%nv, \@nv); print LOG "$time Completed Processing West XLS Data For $report\n" +; }
      The code was changed to die if there was any trouble with closing or printing to the LOG filehandler and the code never reported any errors but "foo" was never printed into log file by the filehandler.