Re: Filter::HTTPD, UTF-8 and cursing

Scott Wiersdorf <[email protected]>
Newsgroups gmane.comp.lang.perl.poe
Message-ID <[email protected]>
On Sat, Mar 22, 2008 at 01:29:03AM -0500, Philip Gwyn wrote:
> 
> POE::Driver::SysRW->put() then sees the following :

Just an idea: I notice POE::Driver::SysRW::put() uses 'use bytes':

<snip>
      # Need to check lengths in octets, not characters.
      use bytes;

      foreach (grep { length } @$chunks) {
        $self->[TOTAL_OCTETS_LEFT] += length;
        push @{$self->[OUTPUT_QUEUE]}, $_;
      }
</snip>

Maybe once it finishes calculating the bytes, we need to put in 'no
bytes' to turn byte-semantics off again:

<snip>
      use bytes;

      # Need to check lengths in octets, not characters.
      foreach (grep { length } @$chunks) {
        $self->[TOTAL_OCTETS_LEFT] += length;
      }

      no bytes;

      ## push it all at once, but w/o byte semantics
      push @{$self->[OUTPUT_QUEUE]}, @$chunks;
</snip>

I've seen this problem before a few years ago in a (non-POE) webmail
application that was doing sort of the same thing. I'm just guessing
here (i.e., untested code may break things!).

HTH,

Scott
-- 
Scott Wiersdorf
<[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.