Andrew Alakozow wrote:
Hello,
I use Apache::FakeRequest to test perl handlers without firing up Apache.
Testting is supposed to be done by matching output of handlers with some
regexps. But the print method of Apache::Request prints to STDOUT, so to
get output I applied following patch to it:
10c10,17
< sub print { shift; CORE::print(@_) }
---
sub print {
my $self = shift;
if (exists $$self{fr_output}) {
$$self{fr_output} .= join ('', @_);
} else { CORE::print(@_) }
}
Now, if fr_output "method" is defined all output comes there.
my $request = Apache::FakeRequest->new(fr_output => '', ...);
If it's "right thing" may be this patch should go to CPAN, and if it's not
"right", I'll be glad to hear how to do it right.
You can use IO::String for this purpose:
http://perl.apache.org/docs/1.0/guide/porting.html#Redirecting_STDOUT_into_a_Scalar
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com