1Catalyst::Action::DeserUisaelrizCeoMnutlrtiibPuatretdC(a3Pt)earllysDto:c:uAmcetnitoant:i:oDneserializeMultiPart(3)
2
3
4
6 Catalyst::Action::DeserializeMultiPart - Deserialize Data in a
7 Multipart Request
8
10 package Foo::Controller::Bar;
11
12 __PACKAGE__->config(
13 # see Catalyst::Action::Deserialize for standard config
14 );
15
16 sub begin :ActionClass('DeserializeMultiPart') DeserializePart('REST') {}
17
19 This action will deserialize multipart HTTP POST, PUT, OPTIONS and
20 DELETE requests. It is a simple extension of
21 Catalyst::Action::Deserialize with the exception that rather than using
22 the entire request body (which may contain multiple sections), it will
23 look for a single part in the request body named according to the
24 "DeserializePart" attribute on that action (defaulting to "REST"). If
25 a part is found under that name, it then proceeds to deserialize the
26 request as normal based on the content-type of that individual part.
27 If no such part is found, the request would be processed as if no data
28 was sent.
29
30 This module's code will only come into play if the following conditions
31 are met:
32
33 · The "Content-type" of the request is "multipart/*"
34
35 · The request body (as returned by "$c-"request->body> is not defined
36
37 · There is a part of the request body (as returned by
38 "$c-"request->upload($DeserializePart)>) available
39
41 By default, HTTP::Body parses "multipart/*" requests as an
42 HTTP::Body::OctetStream. HTTP::Body::OctetStream does not separate out
43 the individual parts of the request body. In order to make use of the
44 individual parts, HTTP::Body must be told which content types to map to
45 HTTP::Body::MultiPart. This module makes the assumption that you would
46 like to have all "multipart/mixed" requests parsed by
47 HTTP::Body::MultiPart module. This is done by a package variable
48 inside HTTP::Body: $HTTP::Body::Types (a HASH ref).
49
50 WARNING: As this module modifies the behaviour of HTTP::Body globally,
51 adding it to an application can have unintended consequences as
52 multipart bodies will be parsed differently from before.
53
54 Feel free to add other content-types to this hash if needed or if you
55 would prefer that "multipart/mixed" NOT be added to this hash, simply
56 delete it after loading this module.
57
58 # in your controller
59 use Catalyst::Action::DeserializeMultiPart;
60
61 delete $HTTP::Body::Types->{'multipart/mixed'};
62 $HTTP::Body::Types->{'multipart/my-crazy-content-type'} = 'HTTP::Body::MultiPart';
63
65 This is a simple sub-class of Catalyst::Action::Deserialize.
66
68 See Catalyst::Action::REST for authors.
69
71 You may distribute this code under the same terms as Perl itself.
72
73
74
75perl v5.30.1 2020C-a0t1a-l2y9st::Action::DeserializeMultiPart(3)