Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

HTTP::Message

by Amoe (Friar)
on Aug 26, 2001 at 00:12 UTC ( [id://107855]=perlquestion: print w/replies, xml ) Need Help??

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

I have a script that gets stuff from the web. It sends the "referer" header with its requests, which are accomplished using HTTP::Request and LWP::UserAgent. Most of the time it works fine. But sometimes I get this error: Unexpected field value http://www.referer.com/referer.html at /blah/blah/perl/site/lib/HTTP/Message.pm Since I don't know what line of the program this is getting called at, I'm having trouble pinning down the error. I would use the debugger, but the errors seem to be random. And seeing as line 189 yields a very informative $self->{'_headers'}->$method(@_);, I'm stuck as to how to cure this problem. Any help would be much appreciated.

Replies are listed 'Best First'.
Re (tilly) 1: HTTP::Message
by tilly (Archbishop) on Aug 26, 2001 at 02:38 UTC
    The _headers object is of class HTTP::Headers. If you look in that class you will find that your error message comes from the _header method. That message would be much more informative if it included the field name, but oh well.

    To debug further I would suggest adding to your script the line:

    use Carp 'verbose';
    That won't fix anything, but it will give you a complete stack backtrace into your code, and you can figure out what is going on from there.

    PS: There is discussion at Are debuggers good? both pro and con on using debuggers for debugging. You might find it an interesting read.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-04-23 14:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found