0

I'm getting this warning (after "use diagnostics;");

Parsing of undecoded UTF-8 will give garbage when decoding entities at /usr/lib/perl5/HTML/PullParser.pm line 81.

My program is like this:

...
use diagnostics;
use WWW::Mechanize;
use WWW::Mechanize::Gzip;
...

$m = WWW::Mechanize::GZip->new(
 agent => $self->{_agent},
 timeout => $self->{_timeout},
);

if (!$m->get($url)) {
 die("Impossibile scaricare l'url [$url]");
}
if (!$m->form_number(1)) {
 die("Impossibile trovare il form 1");
}

 <WARNING IS EMITTED HERE>

...

How to I get rid of it? Or may I safely ignore it?

UPDATE: I just dotice that using WWW::Mechanize->new() insted of WWW::Mechanize::GZip->new() does work silently... So the problem comes from the GZip module...?

MarcoS
  • 17,323
  • 24
  • 96
  • 174

1 Answers1

4

First of all, the question you're asking really is the wrong one. You don't want to suppress those warnings, you want to prevent them.

This sounds like WWW::Mechanize::Gzip is buggy. You don't really need it anyway, LWP has gzip support built in. See this thread (WWW::Mechanize is a subclass of LWP::UserAgent) for an explanation on how to achieve similar results in a more sane way.

Community
  • 1
  • 1
Leon Timmermans
  • 30,029
  • 2
  • 61
  • 110
  • I see. Thanks. You are right, I do not want to suppress any warnings, I would like to understand where do they come from... But, how do I fill a form fields and submit it with LWP::UserAgent? – MarcoS Jul 31 '11 at 15:58
  • I wasn't suggesting to drop WWW::Mechanize… – Leon Timmermans Jul 31 '11 at 21:29
  • I see... You suggest to use WWW::Mechanize instaed of WWW::Mechanize::Gzip, and handle zipped content using LWP, right? – MarcoS Aug 01 '11 at 15:14