Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: "Unexpected field value" error from HTTP::Headers when using WWW::Mechanize

by bobf (Monsignor)
on Mar 18, 2005 at 03:08 UTC ( [id://440614]=note: print w/replies, xml ) Need Help??


in reply to Re: "Unexpected field value" error with WWW::Mechanize
in thread "Unexpected field value" error with WWW::Mechanize

Hi - thanks for checking my code. This code worked for you? I copied exactly what you posted (well, I changed $mech->submit_form to $mech_obj->submit_form) and I still got the same error:

Unexpected field value http://search.cpan.org at (eval 5) line 1

It sounds like there is something else going on at my end. I'll have to keep digging. Thanks again for checking this out for me.

Update: I added use Carp 'verbose' to the test script and got this:

Unexpected field value http://search.cpan.org at C:/ActivePerl/site/li +b/HTTP/Headers.pm line 256 HTTP::Headers::_header('HTTP::Headers=HASH(0x2249820)', 'Referer', 'ht +tp://search.cpan.org') called at C:/ActivePerl/site/lib/HTTP/Headers +.pm line 150 (etc)

The error is coming from the _header subroutine in HTTP::Headers. The code in question is this:

if (!ref($val)) { push(@new, $val); } elsif (ref($val) eq 'ARRAY') { push(@new, @$val); } else { Carp::croak("Unexpected field value $val"); }

I added a Data::Dumper print statement to determine what $val was, and I got the following:

$VAR1 = bless( do{\(my $o = 'http://search.cpan.org')}, 'URI::http' );
which matches the "action" value in the $mech_obj above. The _header routine seems to want scalars (or a ref to an array), but it looks like it's getting a hash ref (or is it the whole object?) from the WWW::Mechanize object instead.

I was not sure how to proceed, so emailed the authors of those modules. Additional suggestions are welcome. (Incidently, now that I know more about the error, I found a previous report of it in HTTP::Message.)

Replies are listed 'Best First'.
Re^3: "Unexpected field value" error from HTTP::Headers when using WWW::Mechanize
by jbrugger (Parson) on Mar 18, 2005 at 08:58 UTC
    Hi, that's weird, indeed it works for me...
    Is your WWW::Mechanize properly installed? my script is here
    and the output is here
    "We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.
Re^3: "Unexpected field value" error from HTTP::Headers when using WWW::Mechanize
by Anonymous Monk on Jun 10, 2005 at 21:45 UTC
    Did you ever find a solution? I am having the exact same problem w/ HTTP::Headers.

Log In?
Username:
Password:

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

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

    No recent polls found