Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Plz help me to create a perl script to catch errors and exceptions

by technology1980
on Aug 22, 2007 at 14:47 UTC ( #634367=perlquestion: print w/replies, xml ) Need Help??

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

Hi All, I am new to Perl Scripting and also to this group ! Can anyone help me out in creating a perl script that has to catch errors and exceptions from a log file in an UNIX box and to store those errors/exceptions into a separate file ! Thanks in adv.
  • Comment on Plz help me to create a perl script to catch errors and exceptions

Replies are listed 'Best First'.
Re: Plz help me to create a perl script to catch errors and exceptions
by Joost (Canon) on Aug 22, 2007 at 15:05 UTC
Re: Plz help me to create a perl script to catch errors and exceptions
by rvosa (Curate) on Aug 22, 2007 at 15:16 UTC
    What do you mean by "catch errors and exceptions"? That sort of phrase is typically interpreted to mean something like:
    eval { &something_that_throws_exceptions }; if ( $@ ) { &exception_handler }
    or even:
    use Exception::Class::TCF; try { &something_that_throws_exceptions } catch 'Default' => \&exception_handler;
    However, because you're also talking about log files, it sounds like you mean something else. Like how to parse a file? Regular expressions? Writing to files? It's impossible to tell. Maybe you have an example of some lines in the log, and some code you've written so far to show your intentions.
    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://634367]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2021-01-21 01:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?