Gangabass has asked for the wisdom of the Perl Monks concerning the following question:
I got this error HTTP::Message content must be bytes when running my program (it uses WWW::Mechanize). Here is the code:
my $query = qq{ <root><post_form_data_action object_name="$object->{reference_ +name}" object_id="$object->{reference_id}" object_version="1" form_na +me="Bookmark" form_context="create" process_id="$object->{process_id} +" > <post_attribute_data attribute_name="SocialMediaAccount" >$acc +ount</post_attribute_data> <post_attribute_data attribute_name="Url" >$object->{url}</pos +t_attribute_data> <post_attribute_data attribute_name="Title" >$object->{title}< +/post_attribute_data> <post_attribute_data attribute_name="Content" >$object->{conte +nt}</post_attribute_data> <post_attribute_data attribute_name="Tags" >$object->{tags}</p +ost_attribute_data> <post_attribute_data attribute_name="Status" >$object->{status +}</post_attribute_data> <post_attribute_data attribute_name="Category" ></post_attribu +te_data> </post_form_data_action> </root> }; $mech->post( $CONFIG{BASE_URL} . "/synnd/webif.awr?undefined", Con +tent => $query );
This error occurs only on few results but it's very weird. I look into $query and it's looks like containig only ASCII. I save $query value to the file with:
open my $error, ">", "error.txt" or die $!; print $error $query; close $error;
Here is $query which produce the error:
<root><post_form_data_action object_name="Buzz" object_id="-23 +789858" object_version="1" form_name="Bookmark" form_context="create" + process_id="92381" > <post_attribute_data attribute_name="SocialMediaAccount" >Soci +alMediaAccount:1592361</post_attribute_data> <post_attribute_data attribute_name="Url" >http://myselfdevelo +pment.net/index.php/2007/05/09/how-to-blow-your-mind-the-10th-dimensi +on/</post_attribute_data> <post_attribute_data attribute_name="Title" >How To Blow Your +Mind: The 10th Dimension SAVE </post_attribute_data> <post_attribute_data attribute_name="Content" >Ok.. the first +time I viewed this, I thought this would be easy… from the 1st dimens +ion to the 2nd and so on… my brain fried around the 5th and sixth dim +ension… never mind the 10th dimension.</post_attribute_data> <post_attribute_data attribute_name="Tags" >science,video,phys +ics,dimensions,mathematics</post_attribute_data> <post_attribute_data attribute_name="Status" >New</post_attrib +ute_data> <post_attribute_data attribute_name="Category" ></post_attribu +te_data> </post_form_data_action> </root>
What's wrong with my data? How i can fix this error?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Error "HTTP::Message content must be bytes" while posting with LWP
by Anonymous Monk on Nov 11, 2009 at 08:23 UTC | |
by Gangabass (Vicar) on Nov 11, 2009 at 09:22 UTC | |
by keszler (Priest) on Nov 11, 2009 at 10:14 UTC | |
by Corion (Patriarch) on Nov 11, 2009 at 10:44 UTC | |
by benno (Novice) on Nov 20, 2011 at 13:41 UTC |