X-Git-Url: https://git.decadent.org.uk/gitweb/?p=maypole.git;a=blobdiff_plain;f=lib%2FCGI%2FMaypole.pm;h=b8a0a48d3d40d6351f00d4533c0ca16e2953ab59;hp=9b2ee7988faaf69d7f8451d06436758219094468;hb=12d8a77a713d5ed4f08414e5f34e96d45f60e2d3;hpb=f4a654d5fee1b79ced98bb6d71a4f3b4bf402ecd diff --git a/lib/CGI/Maypole.pm b/lib/CGI/Maypole.pm index 9b2ee79..b8a0a48 100644 --- a/lib/CGI/Maypole.pm +++ b/lib/CGI/Maypole.pm @@ -7,9 +7,9 @@ use CGI::Simple; use Maypole::Headers; use Maypole::Constants; -our $VERSION = '2.10'; +our $VERSION = '2.11'; -__PACKAGE__->mk_accessors( qw( cgi ) ); +__PACKAGE__->mk_accessors( qw/cgi/ ); =head1 NAME @@ -164,12 +164,28 @@ sub get_protocol =item send_output +Generates output (using C) and prints it. + =cut sub send_output { my $r = shift; + print $r->collect_output; +} + +=item collect_output + +Gathers headers and output together into a string and returns it. + +Splitting this code out of C supports L. +=cut + +sub collect_output +{ + my $r = shift; + # Collect HTTP headers my %headers = ( -type => $r->content_type, @@ -181,7 +197,7 @@ sub send_output $headers{"-$_"} = $r->headers_out->get($_); } - print $r->cgi->header(%headers), $r->output; + return $r->cgi->header(%headers) . $r->output; } =item get_template_root