1 package Catalyst::Request::PartData;
6 has [qw/raw_data name size/] => (is=>'ro', required=>1);
11 handles=>[qw/content_type content_encoding content_type_charset/]);
13 sub build_from_part_data {
14 my ($class, $part_data) = @_;
15 return $part_data->{data} unless $class->part_data_has_complex_headers($part_data);
17 raw_data => $part_data->{data},
18 name => $part_data->{name},
19 size => $part_data->{size},
20 headers => HTTP::Headers->new(%{ $part_data->{headers} }));
23 sub part_data_has_complex_headers {
24 my ($class, $part_data) = @_;
25 return scalar keys %{$part_data->{headers}} > 1 ? 1:0;
28 __PACKAGE__->meta->make_immutable;
32 Catalyst::Request::Upload - handles file upload requests
38 To specify where Catalyst should put the temporary files, set the 'uploadtmp'
39 option in the Catalyst config. If unset, Catalyst will use the system temp dir.
41 __PACKAGE__->config( uploadtmp => '/path/to/tmpdir' );
49 This class defines the following immutable attributes
53 The raw data as returned via L<HTTP::Body>.
57 The part name that gets extracted from the content-disposition header.
61 The raw byte count (over http) of the data. This is not the same as the character
66 An L<HTTP::Headers> object that represents the submitted headers of the POST. This
67 object will handle the following methods:
71 =head3 content_encoding
73 =head3 content_type_charset
75 These three methods are the same as methods described in L<HTTP::Headers>.
79 =head2 build_from_part_data
81 Factory method to build an object from part data returned by L<HTTP::Body>
83 =head2 part_data_has_complex_headers
85 Returns true if there more than one header (indicates the part data is complex and
86 contains content type and encoding information.).
90 Catalyst Contributors, see Catalyst.pm
94 This library is free software. You can redistribute it and/or modify
95 it under the same terms as Perl itself.