hi guys,
Just started on a project with Mojolicious.
Task: to upload a file into mojo and then issue a PUT command to transfer that file to a file server.
I have been struggling to find documentation on using put_p/put in terms of the parameters for the syntax.
I have also tried to look for the source code in the Mojolicious framework which does the actual put_p/put to no avail. I had looked up the source of
Mojo
::
UserAgent and the packages it is "use"-ing also to no avail.
--------
$self->ua->put_p(
# my_target_url_object is a Mojo::URL with the
# user info and actual url of the
# file server defined.
# $file_object is a Mojo::File::Asset representing a file I had uploaded from my local machine
$my_target_url_object => form => {
'content' => $file_object->asset->{'content'},
}
)->then(
sub ($tx) {
return $self->parse_response_p($tx);
}
)->catch(
sub($error) {
p->reject("Connection error: $error");
}
);
-----------
When I use the put call above, the content of my input file becomes "content=+Why+Georgia%3F%0A" instead of just "Why Georgia" (which was what I had uploaded earlier).
I must be doing something wrong.
I have since tried many variations to the call to put_p to no avail.
Sometimes, if i do not provide the hash key, 'content', the actual cost when i cat the file in the target webserver directory would be literally 'HASH%3234234234';
Can any one please point me to proper documentation clearly describing how to execute a put/put_p in a Mojolicious controller?
Thank you, guys
Gordon