[poe-commits] poe/POE/Driver SysRW.pm,1.21,1.22
Brought to you by:
rcaputo
From: <rc...@us...> - 2002-07-31 20:05:53
|
Update of /cvsroot/poe/poe/POE/Driver In directory usw-pr-cvs1:/tmp/cvs-serv16084/POE/Driver Modified Files: SysRW.pm Log Message: Sergey Skvortsov reported that Driver::SysRW uses length() to count octets in buffers, which is broken in newer versions of Perl that support Unicode. In the Unicode sense, length() returns the number of CHARACTERS in a buffer, which may be fewer than the number of octets. This change adds POE/Macro/UseBytes, which is a backward-compatible way of including C<use bytes> in files. It also adds use_bytes directives to wherever looks appropriate. Index: SysRW.pm =================================================================== RCS file: /cvsroot/poe/poe/POE/Driver/SysRW.pm,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** SysRW.pm 30 Jun 2002 21:14:59 -0000 1.21 --- SysRW.pm 31 Jul 2002 20:05:20 -0000 1.22 *************** *** 6,9 **** --- 6,10 ---- package POE::Driver::SysRW; + use POE::Preprocessor ( isa => "POE::Macro::UseBytes" ); use strict; *************** *** 57,60 **** --- 58,63 ---- my $old_queue_octets = $self->[TOTAL_OCTETS_LEFT]; + {% use_bytes %} + foreach (grep { length } @$chunks) { $self->[TOTAL_OCTETS_LEFT] += length; *************** *** 114,117 **** --- 117,122 ---- sub flush { my ($self, $handle) = @_; + + {% use_bytes %} # syswrite() it, like we're supposed to |