2

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?

melpomene
  • 84,125
  • 8
  • 85
  • 148
jsor
  • 637
  • 4
  • 10
  • 1
    I'm not sure what's unclear. Are you just looking for `my $tx = $ua->post('https://whatever.your.site.name.is/login' => form => { user => $user, password => $passwd })`? – melpomene Jan 02 '19 at 15:02

0 Answers0