HTTP::Promise::Body::File - HTTP Message Body File Class
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->print( $filehandle, { binmode => 'utf-8' } ); $body->purge; # ditto $body->reset;
v0.1.0
This class represents an entity body as a file.
This class inherits from HTTP::Promise::Body and Module::Generic::File
Methods superseded by this class are as follow.
This returns the full path to the file.
This removes the underlying file by calling "unlink" in Module::Generic::File
Jacques Deguest <jack@deguest.jp>
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
PerlIO::scalar
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.
To install HTTP::Promise, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTTP::Promise
CPAN shell
perl -MCPAN -e shell install HTTP::Promise
For more information on module installation, please visit the detailed CPAN module installation guide.