develooper Front page | perl.beginners | Postings from January 2002

catching an exception before it reaches command line

Thread Next
Alex Harris
January 17, 2002 08:16
catching an exception before it reaches command line
Message ID:

The program I'm writing is going to run under a cron job. Therefore its 
important that I catch all exceptions in a file and not have them return to 
the command line.

For instance the following:
  (system("ls *.r > $plantfile")
raises this exception at times:
  ls: 0653-341 The file *.r does not exist.

What I want to happen is for that exception and its message to appear in a 
file, not the prompt line, AND for the program to continue on.

Also, there are times where a certain exception will need to kill the 
program, but when I do a 'die' I also need it to be written to a file and 
NOT the command line.

How do I accomplish these two things?

MSN Photos is the easiest way to share and print your photos:

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About