required => 1,
lazy => 1,
);
+has _context => (
+ is => 'rw',
+ weak_ref => 1,
+ clearer => '_clear_context',
+);
sub output { shift->body(@_) }
my ( $self, $buffer ) = @_;
# Finalize headers if someone manually writes output
- $self->finalize_headers;
+ $self->_context->finalize_headers unless $self->finalized_headers;
$buffer = q[] unless defined $buffer;