1 package TestApp::View::Dump;
4 use base 'Catalyst::View';
7 use Scalar::Util qw(blessed weaken);
10 my ( $self, $reference, $purity ) = @_;
12 return unless $reference;
14 $purity = defined $purity ? $purity : 1;
16 my $dumper = Data::Dumper->new( [$reference] );
18 $dumper->Purity($purity);
21 $dumper->Quotekeys(0);
24 local $SIG{ __WARN__ } = sub { warn unless $_[ 0 ] =~ m{dummy} };
29 my ( $self, $c, $reference, $purity ) = @_;
31 # Force processing of on-demand data
34 # Remove body from reference if needed
35 $reference->{__body_type} = blessed $reference->body
36 if (blessed $reference->{_body});
37 my $body = delete $reference->{_body};
39 # Remove context from reference if needed
40 my $context = delete $reference->{_context};
43 $self->dump( $reference, $purity ) )
46 $c->res->headers->content_type('text/plain');
47 $c->res->output($output);
51 $reference->{_context} = $context;
52 weaken( $reference->{_context} );
57 delete $reference->{__body_type};
58 $reference->{_body} = $body;