kidwahoo94 has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to find a way to pipe warning messages into a log file....sometimes I don't want to 'die' if errors are encountered. Sample code: $handle->GetNumber($recs) || die "Can't get number of EventLog records\n"; I'd like to be able to log the errors instead of 'dieing'

Replies are listed 'Best First'.
Re: Logging Warning Messages
by valdez (Monsignor) on Jan 21, 2003 at 17:14 UTC

    Welcome to the Monastery!

    You probably need warn. Be sure to check our Tutorials!

    Ciao, Valerio

Re: Logging Warning Messages
by TStanley (Canon) on Jan 21, 2003 at 17:14 UTC
    CPAN is your friend. A quick search turned up 413 modules to choose from.

    TStanley
    --------
    It is God's job to forgive Osama Bin Laden. It is our job to arrange the meeting -- General Norman Schwartzkopf
Re: Logging Warning Messages
by martymart (Deacon) on Jan 22, 2003 at 09:40 UTC
    Why not try something like this...
    #Output warnings to warnings.log BEGIN{ open(STDERR, "warnings.log")||die "Can't open warning.log: $!"; }
    This should send your warnings to a log file for you, hope this helps