From f555408b953f58d08089103861cc35de03079dd4 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 10 Apr 2008 23:31:12 +0000 Subject: [PATCH] add POD to PseudoRequest. Also, refactor initializing the cached print values --- t/lib/WebGUI/PseudoRequest.pm | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/t/lib/WebGUI/PseudoRequest.pm b/t/lib/WebGUI/PseudoRequest.pm index 87578d305..eaf9238e3 100644 --- a/t/lib/WebGUI/PseudoRequest.pm +++ b/t/lib/WebGUI/PseudoRequest.pm @@ -109,6 +109,7 @@ sub new { fh => undef, size => 0, filename => '', + output => '', }; my $file = shift; if ($file and -e $file) { @@ -349,22 +350,46 @@ sub setup_param { #---------------------------------------------------------------------------- +=head2 clear_output ( ) + +Clear the internally cached request output generated by calling the +C method. + +=cut + sub clear_output { my $self = shift; $self->{output} = ''; } +#---------------------------------------------------------------------------- + +=head2 get_output ( ) + +Get the internally cached request output generated by calling the +C method. Returns it as a scalar. + +=cut + sub get_output { my $self = shift; return $self->{output}; } +#---------------------------------------------------------------------------- + +=head2 print ( @values ) + +Fake print method for the PseudoRequest object. It caches everything printed +to it by concatenating @values together, just like print would. Use clear_output +to clear the cached value, and get_output to access it. + +=cut + sub print { my $self = shift; - $self->{output} ||= ''; - for my $p (@_) { - $self->{output} .= $p; - } + $self->{output} .= join '', @_; + return 1; } #----------------------------------------------------------------------------