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:
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.$VAR1 = bless( do{\(my $o = 'http://search.cpan.org')}, 'URI::http' );
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.)
In reply to Re^2: "Unexpected field value" error from HTTP::Headers when using WWW::Mechanize
by bobf
in thread "Unexpected field value" error with WWW::Mechanize
by bobf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |