NAME
HTTP::Promise::Body::File - HTTP Message Body File Class
SYNOPSIS
use
HTTP::Promise::Body;
my
$body
= HTTP::Promise::Body::File->new ||
die
( HTTP::Promise::Body::File->error,
"\n"
);
my
$body
= HTTP::Promise::Body::File->new(
'/some/where/file,txt'
);
if
(
$body
->is_empty )
{
# do something
}
my
$size
=
$body
->
length
;
# $io is a Module::Generic::File::IO object
my
$io
=
$body
->
open
(
'r'
) ||
die
(
$body
->error );
$io
->
read
(
$buffer
, 2048 );
$io
->
close
;
my
$io
=
$body
->
open
(
'r'
, {
binmode
=>
'utf-8'
} ) ||
die
(
$body
->error );
$io
->
read
(
$buffer
, 2048 );
$io
->
close
;
# open the body as an utf-8 stream and print it to filehandle $filehandle
$body
->
(
$filehandle
, {
binmode
=>
'utf-8'
} );
$body
->purge;
# ditto
$body
->
reset
;
VERSION
v0.1.0
DESCRIPTION
This class represents an entity body as a file.
This class inherits from HTTP::Promise::Body and Module::Generic::File
METHODS
Methods superseded by this class are as follow.
path
This returns the full path to the file.
purge
This removes the underlying file by calling "unlink" in Module::Generic::File
AUTHOR
Jacques Deguest <jack@deguest.jp>
SEE ALSO
HTTP::Promise, HTTP::Promise::Request, HTTP::Promise::Response, HTTP::Promise::Message, HTTP::Promise::Entity, HTTP::Promise::Headers, HTTP::Promise::Body, HTTP::Promise::Body::Form, HTTP::Promise::Body::Form::Data, HTTP::Promise::Body::Form::Field, HTTP::Promise::Status, HTTP::Promise::MIME, HTTP::Promise::Parser, HTTP::Promise::IO, HTTP::Promise::Stream, HTTP::Promise::Exception
Module::Generic::File, Module::Generic::Scalar, Module::Generic::File::IO, Module::Generic::Scalar::IO
COPYRIGHT & LICENSE
Copyright(c) 2022 DEGUEST Pte. Ltd.
All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.