Click here to get back home

HTTP::Response decoded_content is undefined

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
HTTP::Response decoded_content is undefined timlegge 03-28-2007
Posted by timlegge on March 28, 2007, 8:04 am
Please log in for more thread options


Hi

I had a script that was able to parse the decoded_content for the
forms in a html page. However, a recent update to the page broke the
script (        @forms = HTML::Form->parse($response->decoded_content,
$response->base);) was unable to find the forms in the web page.
After much research I found that the decoded_content was empty but the
call to parse seemed happy with HTML::Form->parse($response->content,
$response->base); instead.

It looks like the issue may have been caused by the addition of a meta
tag to the html page:

<meta http-equiv="Content-Type" content="text/html;charset=utf-8">

so far, I have been unable to prove that as the page is generated via
compiled javascript and is painful to change.

Any idea whether this meta tag would cause an issue with
decoded_content and whether there might be a work around...

Tim


Posted by jzhang on March 29, 2007, 8:47 pm
Please log in for more thread options


> Hi
>
> I had a script that was able to parse the decoded_content for the
> forms in a html page. However, a recent update to the page broke the
> script ( @forms = HTML::Form->parse($response->decoded_content,
> $response->base);) was unable to find the forms in the web page.
> After much research I found that the decoded_content was empty but the
> call to parse seemed happy with HTML::Form->parse($response->content,
> $response->base); instead.
>
> It looks like the issue may have been caused by the addition of a meta
> tag to the html page:
>
> <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
>
> so far, I have been unable to prove that as the page is generated via
> compiled javascript and is painful to change.
>
> Any idea whether this meta tag would cause an issue with
> decoded_content and whether there might be a work around...
>
> Tim

I've also met such kind of error when processing Chinese web pages.
It seems decoded_content() failed to recognize the charset of your web
page.
You can try $response->decoded_content('default_charset'=>'utf8');
Or you can hack the decoded_content function in HTTP::Message module,
to make the charset detection part more sophisticated.

Zhang Jun




Similar ThreadsPosted
Parse tcpdump for HTTP Request Response Headers July 29, 2007, 2:10 pm
Net::Analysis Parse tcpdump for HTTP Request/Response Headers July 29, 2007, 6:41 am
"Undefined subroutine" November 21, 2004, 8:48 pm
Getting "undefined sysmbol February 8, 2005, 8:12 am
GD-1.38: Undefined symbol: .__fixsfsi July 12, 2004, 10:43 am
undefined symbol: gdImageCreateFromGif June 14, 2007, 1:00 pm
LibXML "Undefined namespace prefix" July 2, 2007, 5:42 pm
Can't call method on an undefined value at June 27, 2005, 2:56 pm
check response with mod_perl October 22, 2004, 11:23 am
URGENT: no response - LWP::UserAgent February 26, 2005, 12:22 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap