Guide Home
POD Home



Sloop::Multipart::Data objects are constructed by a Sloop::Multipart object for each part found in an HTTP multipart post body.



The name of the part. This corresponds to the name attribute of the HTML input tag responsible for this part. Since some inputs can provide multiple parts, it is not necessarily unique in relation to other Sloop::Multipart::Data objects produced by the same request.


This is the accumulated length of the content.


The HTTP protocol requires individual headers for each part; {headers} is a hash reference to them much like the one in a Sloop::Client::Request, except this is two tiered: 'content-disposition' is a sub hash. Note that $mpd->{headers}->{'content-disposition'}->{name} is the same as $mpd->{name}.


The full pathname of the tmp file used to store content. This file is automatically deleted by $mpd->DESTROY when (e.g.) $mpd goes out of scope.



Retrieves the base filename of the part, if this a file upload.

Returns The file name, or undef.


Convenience method for retrieving a value from $mpd->{headers}.

$key is the name of the header.


This will move (via File::Copy::move()) $mpd->{tmpfile} to a more permanent location.

$filepath is the full path to move the file to. The sloop process must have write permission to this location.

Returns 1 for success, 0 for failure.


Convenience method for getting the content, rather than dealing with $mpd->{tmpfile}. Do not call this method this after placeFile() or otherwise moving the {tmpfile}, or call it multiple times; {tmpfile} will be deleted after the call.

Returns The content of $mpd->{tmpfile}.


API call to retrieve the size of $mpd->{data} before the content is accessed. Afterward, this will return undef.

Returns For _MEM_ based objects, undef. Otherwise, the size in bytes of $mpd->{tmpfile}.