You can write another function my_die inside your program and  customize
according your requirements. 
Something as below 

Sub my_die() {
  my $message = shift;

        If ( $ENV{MY_ERR_LOG} ) {
                open the file and write to it

        } else {
        die ("$message");
        }
}
        
--Koteswara Rao

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Steve Remme
Sent: Friday, August 31, 2007 12:07 AM
To: perl-unix-users@listserv.ActiveState.com
Subject: [Perl-unix-users] Sending "die" and "warn" messages to a file.

Is it possible to send the output from the 'die' and/or 'warn' commands
to a file instead of stderr? Ideally, I would like this behavior to be
configurable based on the  existence of an environment variable.

For example, if the environment variable MY_ERR_LOG is set to "err.txt" 
then err.txt would contain any die/warn messages. Otherwise, any
die/warn messges would go to the normal stderr.

I apologize if there is a "simple" answer. I just don't have the time to
play with this, and I didn't find anything that looked useful on google.

Thanks!

--
~~~~~~~~~~~~~~~~~~~~~~~~~~
Steve Remme
Sr. Hw Engineer
Sun Microsystems - Storage Group
Phone: 303.673.6966
~~~~~~~~~~~~~~~~~~~~~~~~~~


NOTICE: This email message is for the sole use of the intended
recipient(s) and may contain confidential and privileged information.
Any unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.

_______________________________________________
Perl-Unix-Users mailing list
Perl-Unix-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Unix-Users mailing list
Perl-Unix-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to