add POD to PseudoRequest. Also, refactor initializing the cached print values

This commit is contained in:
Colin Kuskie 2008-04-10 23:31:12 +00:00
parent 3f0656e971
commit f555408b95

View file

@ -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<print> method.
=cut
sub clear_output {
my $self = shift;
$self->{output} = '';
}
#----------------------------------------------------------------------------
=head2 get_output ( )
Get the internally cached request output generated by calling the
C<print> 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;
}
#----------------------------------------------------------------------------