Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Here's the solution I employ in my own hacked copy of Test::WWW::Mechanize::Catalyst, which I submitted to RT [cpan.org].

           if ($response->header('Content-Type') &&
               $response->header('Content-Type') =~ m/charset=(\S+)/xms) {
              my $encoding = $1;
              $response->content(Encode::decode($encoding, $response->content));
           }
    So far, that's worked great for me, but then I have the luxury of working almost exclusively in UTF-8 with trustworthy content.

    I tried 1.29_01 and got this failure:

    t/local/back.............NOK 28/38
    #   Failed test '404 check'
    #   at t/local/back.t line 149.
    #          got: '500'
    #     expected: '404'
    [... snip ...]
    t/local/overload.........skipped
            all skipped: Mysteriously stopped passing, and I don't know why.
    [... snip ...]
    Failed Test    Stat Wstat Total Fail  List of Failed
    ------------------------------------------------------------------------ -------
    t/local/back.t    1   256    38    1  28
    1 test skipped.
    but then I do run pretty aggressive firewall settings on my Mac, so it might be me...

    When adding 1.29_01 to my @INC, all tests continue to pass for the Catalyst app I'm currently working on, so that's a thumbs up from me.

    As for the warning, I've posted a patch [chrisdolan.net] which works for the wikipedia test, but breaks the o-umlaut test in t/local/follow.t

    • Wouldn't it be better to just use the decoded_content method of the HTTP::Message (Response) object? Or is there some problem with that?

      • Oh, uh, yeah... The significant problem with the function is my ignorance of its existence. :-/
      • unfortunately, that makes t/local/nonascii.t break, and that has been a test that worked with mech for years. (it is derived from a number of tests in the RT testsuite)