1Catalyst::Action::DeserUisaelrizCeo(n3t)ributed Perl DocCuamteanltyastti:o:nAction::Deserialize(3)
2
3
4
6 Catalyst::Action::Deserialize - Deserialize Data in a Request
7
9 package Foo::Controller::Bar;
10
11 __PACKAGE__->config(
12 'default' => 'text/x-yaml',
13 'stash_key' => 'rest',
14 'map' => {
15 'text/x-yaml' => 'YAML',
16 'text/x-data-dumper' => [ 'Data::Serializer', 'Data::Dumper' ],
17 },
18 );
19
20 sub begin :ActionClass('Deserialize') {}
21
23 This action will deserialize HTTP POST, PUT, and OPTIONS requests. It
24 assumes that the body of the HTTP Request is a serialized object. The
25 serializer is selected by introspecting the requests content-type
26 header.
27
28 The specifics of deserializing each content-type is implemented as a
29 plugin to Catalyst::Action::Deserialize. You can see a list of
30 currently implemented plugins in Catalyst::Controller::REST.
31
32 The results of your Deserializing will wind up in $c->req->data. This
33 is done through the magic of Catalyst::Request::REST.
34
35 While it is common for this Action to be called globally as a "begin"
36 method, there is nothing stopping you from using it on a single
37 routine:
38
39 sub foo :Local :Action('Deserialize') {}
40
41 Will work just fine.
42
43 When you use this module, the request class will be changed to
44 Catalyst::Request::REST.
45
47 You likely want to look at Catalyst::Controller::REST, which implements
48 a sensible set of defaults for a controller doing REST.
49
50 Catalyst::Action::Serialize, Catalyst::Action::REST
51
53 See Catalyst::Action::REST for authors.
54
56 You may distribute this code under the same terms as Perl itself.
57
58
59
60perl v5.12.1 2010-09-01 Catalyst::Action::Deserialize(3)