[Catalyst] HTTP::Body(::OctetScream)'s strange behaviour
Daisuke Murase
typester at cpan.org
Tue Nov 22 16:04:43 CET 2005
Hi sri, chansen.
I found strange behaviour arround HTTP::Body and/or
HTTP::Body::OctetStream.
In HTTP::Body sub add :
$self->{buffer} .= $_[0];
and in HTTP::Body::OctetStream sub spin:
if ( my $length = length( $self->{buffer} ) ) {
$self->body->write( substr( $self->{buffer}, 0, $length ),
}
This is strange obviously.
$self->body is broken when HTTP::Body->add called two times or more.
It shuold be:
- $self->{buffer} .= $_[0];
+ $self->{buffer} = $_[0];
or
if ( my $length = length( $self->{buffer} ) ) {
$self->body->write( substr( $self->{buffer}, 0, $length ),
+ $self->{buffer} = '';
}
or something elegant fix.
--
Daisuke Murase <typester at cpan.org>
More information about the Catalyst
mailing list