On Sat, Jul 12, 2014 at 09:20:44AM -0700, sri wrote:
> > I would love to see form handling in UserAgent to make filling out forms
> > easier. I hate having to specify every input in the form when I mostly
> > want defaults.
> >
>
> What would that look like?
Perhaps a wrapper to ->post( form => { ... } )?
my $tx = ...->res->forms( name => 'login' )
->submit({ user => 'me', password => '12345'});
being a shortcut to
my $form = ...->res->dom->at('form name[login]');
my $action = parse_action_from( $form );
my %inputs = parse_inputs_from( $form );
my $tx = $ua->post( $action => form => {
%inputs, user => 'me', password => '12345' } );
Where the parse_X_from are easy enough to write, but annoying.
# default to the first form on the page
perl -Mojo -E 'say g("http://localhost:3000")->res->forms
->submit( user => "me", pass => "sekret" )->dom->at("title")->text';
l8rZ,
--
andrew - http://afresh1.com
Hey, I think I see a barn up ahead.
-- The American Astronaut
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.