The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

HTTP::Promise::Body::Form::Field - HTTP Form Field Class

SYNOPSIS

    use HTTP::Promise::Body::Form::Field;
    my $f = HTTP::Promise::Body::Form::Field->new(
        name => 'picture',
        file => '/some/where/image.png',
        headers => [ conten_type => 'image/png' ],
    );

    my $f = HTTP::Promise::Body::Form::Field->new(
        name => 'picture',
        # Module::Generic::File or HTTP::Promise::Body::File object are ok
        file => $file_object,
        headers => [ conten_type => 'image/png' ],
    );

    my $f = HTTP::Promise::Body::Form::Field->new(
        name => 'fullname',
        body => "John Doe",
    );

    my $f = HTTP::Promise::Body::Form::Field->new(
        name => 'fullname',
        body => \$some_content,
    );

    my $f = HTTP::Promise::Body::Form::Field->new(
        name => 'fullname',
        # HTTP::Promise::Body::Scalar object is ok too
        body => $body_object,
    );

VERSION

    v0.1.0

DESCRIPTION

This class represents a form field. This is used primarily in conjonction with HTTP::Promise::Body::Form::Data

METHODS

body

Sets or gets the field body object.

headers

Sets or gets an headers object

is_body_in_memory

Returns true if the field body is an HTTP::Promise::Body::Scalar object, false otherwise.

is_body_on_file

Returns true if the field body is an HTTP::Promise::Body::File object, false otherwise.

name

Sets or gets the field name as a scalar object

value

This retrieves the field data as a new scalar object, regardless if it the field body is in memory or on file.

Whatever argument is provided, is passed through to "as_string" in HTTP::Promise::Body

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

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.