[Catalyst] Questions about $c->write

Bernhard Graf catalyst2 at augensalat.de
Sat May 5 15:54:08 GMT 2007


Andy Grundman wrote:

> >  Writes the buffer to the client. Can only be called once for a
> > request.
> >
> > Is the second phrase correct? I couldn't see why and at least
> > finalize_body() from the same package can do many calls to write()
> > for one request.
>
> That's not correct, write() can be called as many times as needed to
> send data.  See the implementation of finalize_body in
> Catalyst::Engine for one example.

Seems we are d'accord. The documentation should be fixed.

> > Then I'm a little confused about
> > Catalyst::Engine::FastCGI::write(): In the source you find
> >
> > *STDOUT->syswrite($buffer);
> >
> > Looks like IO::Handle is loaded somewhere, but this turns out as a
> > mistake, because other than documented this syswrite() doesn't
> > return the number of bytes written - at least not as a Perl integer
> > value, but
> > instead returns the size as a binary value.
> > Because the class of this syswrite hides behind the STDOUT glob,
> > I'm not
> > able to track this bug up to the origin.
> >
> > Anybody knows what's behind the file handles in this module?
>
> What bug are you seeing?

I see syswrite() returning something binary - not a Perl integer as 
documented. This binary value can be unpack("U*", $rc)'ed to get the 
correct/expected value.

Probably the bug is in another module, but I'm not able to find out to 
which class this syswrite() belongs.
-- 
Bernhard Graf



More information about the Catalyst mailing list