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.
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: