X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=trunk%2Ft%2Flib%2FTestApp%2FView%2FDump.pm;fp=trunk%2Ft%2Flib%2FTestApp%2FView%2FDump.pm;h=0000000000000000000000000000000000000000;hb=f436bc1bece2bcc2a04138068e5c22e70d9d6d35;hp=a59e417ef90225e40818b8ab8bd69488f82ea2b0;hpb=e28a6876ad3e11890226e5bab6df4b0725e0981e;p=catagits%2FCatalyst-Runtime.git diff --git a/trunk/t/lib/TestApp/View/Dump.pm b/trunk/t/lib/TestApp/View/Dump.pm deleted file mode 100644 index a59e417..0000000 --- a/trunk/t/lib/TestApp/View/Dump.pm +++ /dev/null @@ -1,64 +0,0 @@ -package TestApp::View::Dump; - -use strict; -use base 'Catalyst::View'; - -use Data::Dumper (); -use Scalar::Util qw(blessed weaken); - -sub dump { - my ( $self, $reference ) = @_; - - return unless $reference; - - my $dumper = Data::Dumper->new( [$reference] ); - $dumper->Indent(1); - $dumper->Purity(1); - $dumper->Useqq(0); - $dumper->Deepcopy(1); - $dumper->Quotekeys(0); - $dumper->Terse(1); - - return $dumper->Dump; -} - -sub process { - my ( $self, $c, $reference ) = @_; - - # Force processing of on-demand data - $c->prepare_body; - - # 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->res->headers->content_type('text/plain'); - $c->res->output($output); - - if ($context) { - # Repair context - $reference->{_context} = $context; - weaken( $reference->{_context} ); - } - - if ($body) { - # Repair body - delete $reference->{__body_type}; - $reference->{_body} = $body; - } - - return 1; - } - - return 0; -} - -1;