X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FTestApp%2FView%2FDump.pm;h=c4c29dbfa4d7ab62618df2389d4eb52214ecae9c;hb=269194b4f9de3905430a2d1f21f68da13b2b9ed9;hp=7acfa6d8b438a7034fda22923d0fb706813d40e2;hpb=f9bcc1280f6685f1d937688ed9c035bc9994a01e;p=catagits%2FCatalyst-Runtime.git diff --git a/t/lib/TestApp/View/Dump.pm b/t/lib/TestApp/View/Dump.pm index 7acfa6d..c4c29db 100644 --- a/t/lib/TestApp/View/Dump.pm +++ b/t/lib/TestApp/View/Dump.pm @@ -4,7 +4,7 @@ use strict; use base 'Catalyst::View'; use Data::Dumper (); -use Scalar::Util qw(weaken); +use Scalar::Util qw(blessed weaken); sub dump { my ( $self, $reference ) = @_; @@ -28,14 +28,16 @@ sub process { # Force processing of on-demand data $c->prepare_body; - # Remove context from reference if needed - my $context = delete $reference->{_context}; - # Remove body from reference if needed + $reference->{__body_type} = blessed $reference->body + if (blessed $reference->{_body}); my $body = delete $reference->{_body}; + # Remove context from reference if needed + my $context = delete $reference->{_context}; + if ( my $output = - $self->dump( $reference || $c->stash->{dump} || $c->stash ) ) + $self->dump( $reference ) ) { $c->res->headers->content_type('text/plain'); @@ -46,6 +48,7 @@ sub process { weaken( $reference->{_context} ); # Repair body + delete $reference->{__body_type}; $reference->{_body} = $body; return 1;