1 package Catalyst::Action::Serialize::Data::Serializer;
4 use namespace::autoclean;
6 extends 'Catalyst::Action';
10 $VERSION = eval $VERSION;
14 my ( $controller, $c, $serializer ) = @_;
17 $controller->{'serialize'} ?
18 $controller->{'serialize'}->{'stash_key'} :
19 $controller->{'stash_key'}
28 $c->log->info("Could not load $serializer, refusing to serialize: $@");
31 my $dso = Data::Serializer->new( serializer => $serializer );
32 my $data = $dso->raw_serialize($c->stash->{$stash_key});
33 $c->response->output( $data );
37 __PACKAGE__->meta->make_immutable;
47 Catalyst::Action::Serialize::Data::Serializer - Serialize with Data::Serializer
51 package MyApp::Controller::Foo;
54 use namespace::autoclean;
56 BEGIN { extends 'Catalyst::Controller' }
59 'default' => 'text/x-yaml',
60 'stash_key' => 'rest',
62 'text/x-yaml' => 'YAML',
63 'application/json' => 'JSON',
64 'text/x-data-dumper' => [ 'Data::Serializer', 'Data::Dumper' ],
70 This module implements a serializer for use with C<Data::Dumper> and others. It
71 was factored out of L<Catalyst::Action::REST> because it is unlikely to be
72 widely used and tends to break tests, be insecure, and is generally weird. Use
77 Adam Jacob E<lt>adam@stalecoffee.orgE<gt>, with lots of help from mst and jrockway
79 Marchex, Inc. paid me while I developed this module. (L<http://www.marchex.com>)
83 Tomas Doran (t0m) E<lt>bobtfish@bobtfish.netE<gt>
89 Daisuke Maki E<lt>daisuke@endeworks.jpE<gt>
93 Brian Phillips E<lt>bphillips@cpan.orgE<gt>
95 Dave Rolsky E<lt>autarch@urth.orgE<gt>
99 Arthur Axel "fREW" Schmidt E<lt>frioux@gmail.comE<gt>
101 J. Shirley E<lt>jshirley@gmail.comE<gt>
103 Gavin Henry E<lt>ghenry@surevoip.co.ukE<gt>
105 Gerv http://www.gerv.net/
107 Colin Newell <colin@opusvl.com>
109 Wallace Reis E<lt>wreis@cpan.orgE<gt>
113 Copyright (c) 2006-2013 the above named AUTHOR and CONTRIBUTORS
117 You may distribute this code under the same terms as Perl itself.