tcordes has asked for the wisdom of the Perl Monks concerning the following question:

Ran into some glitches after a FF upgrade, so I installed the latest versions of some of the modules, like MozRepl::Client. My W:M:F is a few months old still though.

I'm getting a weird new problem. Sometimes my program dies at the same place on the same page during a scrape/crawl. Sometimes it makes it past with no error. The page contents are semi-dynamic and there may be subtle changes between hits?

Here's the error:

(Sub)string is [[object Object] &#65533;&#65533;&#65533; {o] at /usr/l +ocal/share/perl5/MozRepl/RemoteObject.pm line 251, <STDIN> line 34. malformed JSON string, neither array, object, number, string or atom, +at character offset 1 (before "object Object] \x{2014}...") at /usr/l +ocal/share/perl5/MozRepl/RemoteObject.pm line 239 (in cleanup) command timed-out at /usr/local/share/perl5/MozRepl/C +lient.pm line 186

I think perhaps it's hitting some embedded UTF8? Shouldn't it be able to happily handle that? Any ideas on where to start looking to apply a fix? Thanks!

Replies are listed 'Best First'.
Re: WWW::Mechanize::Firefox malformed JSON error?
by Corion (Patriarch) on Aug 13, 2011 at 05:12 UTC
    There are some issues where I haven't tracked down the cause. It seems to be that mozrepl sends more output than expected in some situations. There is discussion on the bugtracker, and a likely approach will be to write what mozrepl calls a "custom interactor".
      Hi, Any updates on this? Will upgrading MozRepl or Mechanize::Firefox fix this issue? We're getting this for a lot more pages we're trying to process. Is there a way to work around this error that allows to go ahead and work with the partially loaded page? Regards

        You could try with a recent version of MozRepl::RemoteObject and a recent version of <c>mozrepl

        , as they are both more UTF-8-safe nowadays.

        Please note that unless you supply a test case it is highly unlikely that I will work on an issue. If I can't reproduce something, I cannot tell whether any change fixes it.