>>>>> "Randal" == Randal L Schwartz <mer...@stonehenge.com> writes:

Randal> Yeah, just coded that.  In a BEGIN block in my app, I monkey-patched
Randal> read_from_client:

And then I've also tried to monkey-patch ->read just as you said.

On the first read, an empty string is apparently returned, which fails
something higher in CGI.pm.  Ugh.

Update:

This monkey patch works:

  *Apache2::RequestRec::read = sub {
    warn "READ CALLED";
    goto &$orig;
  }

Although it doesn't do any decoding.  When I replace the body of that
with your code, I'm getting these zero-byte reads.  Even this fails:

    my ($r, $buff, $len, $offset)=@_;
    # my $_buff;
    # my $rc = $r->$orig($_buff, $len);
    my $rc = $r->$orig($buff, $len, $offset);
    # warn "BEFORE: ", DBI::data_string_desc($_buff);
    # utf8::decode($_buff);
    # warn "AFTER: ", DBI::data_string_desc($_buff);
    # substr($buff, $offset, undef, $_buff);
    # warn "AFTER: ", DBI::data_string_desc($buff);
    return $rc;

which should be the same as your code without the utf8 encoding still.
Still getting 0 bytes though.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<mer...@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix consulting, Technical writing, Comedy, etc. etc.
Still trying to think of something clever for the fourth line of this .sig

Reply via email to