convert curl command line to Perl WWW::Curl or LWP -


i'm trying replicate following command line curl:

curl -f file=@myfile.csv 'https://myserver/api/import/data_save.html' 

does have example in either www::curl or lwp perhaps? have been trying day , it's not worth me posting tries @ point, confuse things. thank you!!!

i think asking how submit form file field named file populated contents of file myfile.csv.

use lwp::useragent qw( );  $ua = lwp::useragent->new();  $response = $ua->post('https://myserver/api/import/data_save.html',    content_type => 'form-data',    content => [       file => [ 'myfile.csv' ],    ], );  die($response->status_line)    if !$response->is_success; 

the arguments $ua->post documented in http::request::common.