The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::Curl::Simple::Form - simplify Net::Curl::Form a little

SYNOPSIS

 use Net::Curl::Simple;
 use Net::Curl::Simple::Form;

 my $form = Net::Curl::Simple::Form->new();
 $form->contents( foo => "bar" )->file( photos => glob "*.jpg" );
 $form->add( name => "html", contents => "<html></html>",
     contenttype => "text/html" );

 Net::Curl::Simple->new->post( $uri, \&finished, $form );

DESCRIPTION

Net::Curl::Simple::Form is a thin layer over Net::Curl::Form. It simplifies common tasks, while providing access to full power of Net::Curl::Form when its needed.

CONSTRUCTOR

new

Creates an empty multipart/formdata object.

 my $form = Net::Curl::Simple::Form->new;

METHODS

add( OPTIONS )

Adds a section to this form. Behaves in the same way as add() from Net::Curl::Form but also accepts literal option names. Returns its own object to allow chaining.

contents( NAME, CONTENTS )

Shortcut for add( name => NAME, contents => CONTENTS ).

file( NAME, FILE1, [FILE2, [...] ] )

Shortcut for add( name => NAME, file => FILE1, file => FILE2, ... ).

SEE ALSO

Net::Curl::Simple Net::Curl::Form curl_formadd(3)

COPYRIGHT

Copyright (c) 2011 Przemyslaw Iskra <sparky at pld-linux.org>.

This program is free software; you can redistribute it and/or modify it under the same terms as perl itself.