submitting form with Mojo::UserAgent

248 views Asked by At

I want to submit a form using Mojo::UserAgent where the form has the following:

<form action="/login" method="post" class="Login">

which has 2 inputs ids user and password

With WWW::Mechanize I am using something like this:

my $resp = $agent->submit_form(
    form_number => 4,
    fields => {
    user => $user,
    password => $passwd,
    }
);

On Mojo::UserAgent I see there is an option to submit a post request, something like:

my $tx = $ua->post(
    'https://metacpan.org/search' 
        => form => {q => 'mojo'}
);

How can I submit such a form with Mojo::UserAgent?

0

There are 0 answers