Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

eval { $content = $response->decoded_content }; if ($content) { $response->content($content); }

That's bad. HTTP::Message has separate methods for this for a very good reason: An HTTP message can only ever be a sequence of octets. Together with the charset attribute of the Content-Type header, you can decode this sequence of octet, and get a Unicode string from it; the decoded_content method automates this common use. It looks like PoCoCli::HTTP is trying to be helpful and do this so that its users don't have to, but this is a bad idea because:

  • It destroys the coherence between content and Content-Type;charset
  • It destroys the coherence between content and Content-Length
  • It destroys the original octet buffer, which might be very useful (e.g. to re-send octet-verbatim efficiently, or because the charset attribute was incorrect but you know what it should have been)
  • The message is no longer actually HTTP, because HTTP as a TCP protocol is purely octet based
I guess the LWP author got tired of (hearing about) weird bugs caused by sending this kind of corrupt HTTP messages and decided to end this madness. I applaud this decision. Now PoCoCli::HTTP's author has to fix their module. Which, yes, will probably break lots of existing code using PoCoCli::HTTP that depended on this helpfulness. And again we see that innocent users are hurt by someone's ignorance of (or lack of appreciation for) the binary versus text distinction.

Remove these two lines, and use decoded_content instead of content if you need the decoded content.

Juerd # { site => '', do_not_use => 'spamtrap', perl6_server => 'feather' }

In reply to Re: libwww-perl, POE and Unicode by Juerd
in thread libwww-perl, POE and Unicode by OverlordQ

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others about the Monastery: (4)
    As of 2020-11-30 02:26 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found