perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoffrey Young <>
Subject Re: Using bytes_sent in mod_perl2
Date Thu, 02 Aug 2007 18:09:19 GMT

>>> unless (exists $ENV{MOD_PERL}
>>> 		? Apache2::RequestUtil->request()->bytes_sent()
>>> 		: tell STDOUT)
>>> {
>>> #... send response headers
>> since you no longer send response headers in mp2, isn't this all moot?
> Did you overlook the fact that I'm running all this through
> ModPerl::Registry, or am I overlooking something?

no, I didn't overlook it.  but I did forget you said it was in
mod_cgi-compat mode - I haven't thought in those terms in years :)

still, you can't bee in full CGI mode if you're making mod_perl API
calls like $r->bytes_sent,  in which case...

in mp1 the idiom was this

  print $content;

but note that the 'text/html' part is just calling $r->content_type() as
a convenience.  so the above is equivalent to

  print $content;

in mp2 we don't need to worry about the headers, as the header filter
does all the work, so it looks like this

  print $content;

so, if you are able to change your

  print "Content-Type: text/html\n\n";

and like lines to equivalent mp2 API calls you should be ok.

of course, none of this addresses your original bytes_sent() problem,
but that's probably because I've never seen it used that way, even in
the days of old.

does this help?


View raw message