perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Vanasco <jvana...@2xlp.com>
Subject Re: re-factoring 'print' for $r
Date Sat, 22 Dec 2007 22:21:34 GMT

On Dec 22, 2007, at 4:47 PM, Perrin Harkins wrote:
> By the way, if you just call print() normally it should all be grabbed
> by mod_perl anyway.  Is there some reason you need to call $r->print()
> instead?

I thought it only does that if you bind STDOUT the right way on  
compile time, otherwise it just gets lost in the ether

If you're using a $r you stash somewhere, make sure you undef it on a  
cleanup - just to be safe

also, instead of
	$mnh::r->print( $package_response );

you could do something like...

	mnh::r::printer( $package_response );

where

package mnh::r;

our $r;
function printer {
	if ( !defined $r ) {
		$r= #get $r;
		$r->print( $_[0] )
	}
}

for the performance hit, you can now swap how you print without  
find&replace again

Mime
View raw message