Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Wanted: Error Documentation

by hesco (Deacon)
on Mar 19, 2006 at 23:23 UTC ( #537822=perlquestion: print w/replies, xml ) Need Help??

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

My google searches described this one as an "obscure error". I would of course appreciate any clues what this might mean:
hesco@localhost:~$ perl -wc scrape.pl Too many arguments for regexp internal reset at scrapevote.pl line 21, + near "qw{<tr><td>(.*)</td><td>(.*)</td><td align='right'>(\d)</td><t +d>(.*)</td><td>(.*)</td></tr>}) " scrapevote.pl had compilation errors.
But my real question is this:

Is there any definitive repository where one can look up error messages thrown by perl that will offer me some idea of what to do about them?

I imagine I will have coded around this error long before I figure out what it means. (TIMTOWTDI, after all.). But knowing a single definitive reference for perl errors would be a great boon to my work. Surely such an animal exists, no?

-- Hugh

Replies are listed 'Best First'.
Re: Wanted: Error Documentation
by jdporter (Chancellor) on Mar 19, 2006 at 23:55 UTC

    To get an explanation of a message thrown by your program after the fact, you can run the splain program.

    To get your program to emit more useful messages in the first place, simply insert use diagnostics; at the top.

    You can always read the message explanations on line, in perldiag.

    We're building the house of the future together.
Re: Wanted: Error Documentation
by GrandFather (Saint) on Mar 19, 2006 at 23:38 UTC

    use diagnostics; may help.


    DWIM is Perl's answer to Gödel
Re: Wanted: Error Documentation
by robin (Chaplain) on Mar 21, 2006 at 17:42 UTC
    In case you haven't spotted it yet, your actual problem is that you have used qw instead of m or qr to quote the regex.

    $ perl -e 'print "hello" =~ qw{foo bar}' Too many arguments for regexp internal reset at -e line 1, at EOF Execution of -e aborted due to compilation errors.

    (You're literally passing too many arguments to the regex matcher, i.e. a list of strings rather than the single regex that it expects.)

Re: Wanted: Error Documentation
by graff (Chancellor) on Mar 21, 2006 at 05:06 UTC
    Just taking an intuitive stab at that message: "Too many arguments for regexp internal reset..." -- hmmm. Too many of something or other... Maybe too many occurrences of "(.*)" placed between too many similar html tag patterns.

    Those "(.*)"'s are all greedy matches, and if the regex engine decides that it needs to backtrack in order to satisfy the match, it seems like that might get pretty complicated -- lots of possible paths to take... probably too many!

    So first thing to try: make them non-greedy -- you should be doing that anyway, in order for this thing to even come close to doing what you probably want.

    Of course, the obvious thing to try would be a real HTML parsing module. (I wonder how many times this suggestion is offered in SoPW? -- in fact, how many times every day?) It's not that hard, and it comes out better.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2022-09-28 08:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (124 votes). Check out past polls.

    Notices?