Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Parsing perl errors

by wumpus (Sexton)
on Feb 03, 2009 at 03:50 UTC ( [id://740894]=perlquestion: print w/replies, xml ) Need Help??

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

We have various log files, and perl helpfully outputs error messages into them. We'd like to be able to figure out which lines we should get upset about. For example, "^Undefined subroutine in sort". Once I know this is a problem, I can (for example) email someone when this shows up in my logfiles.

So I took the perldiag 5.8.8 manpage and made a list of all 676 errors (noting that several that I've seen aren't on this list), made regexes to recognize them, built a test suite, and then thought to myself, "Self, has someone done this?", followed by "Self, this is kinda lame, surely there's a better way?"

I'm happy to make a cpan module if there isn't one. Or tell me, is there a better way? I mean, dozens of daemons running on hundreds of nodes can't be simple, but this is ridiculous.

Replies are listed 'Best First'.
Re: Parsing perl errors
by Fletch (Bishop) on Feb 03, 2009 at 04:37 UTC

    You might also look at splain which does something similar (post-processing perl's messages to show the corresponding diagnostic from perldiag).

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

      Yes, that's basically what I did.

      My next question is, would this make a good cpan module? Where in the namespace would it live?

        Was this the wrong place to ask this question?
Re: Parsing perl errors
by jethro (Monsignor) on Feb 03, 2009 at 04:09 UTC

    Building the regexes from the perldiag man page could be automated. Take every line after an empty line, do  s/%\S+/.+/g and voila, there is your regex.

    In special cases (centrally compiled perl) the perl interpreter source could be changed so that all error messages are prefixed with a string like "PERL ERROR"

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2024-04-20 03:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found