The built in "multipart" generator is pretty similar to this. You need to create the parts and set the content type yourself still but it does give you a little flexibility with hashrefs. See the end of the docs for https://metacpan.org/pod/Mojo::UserAgent::Transactor#tx
-Dan On Fri, May 15, 2020 at 12:10 AM Stefan Adams <s1037...@gmail.com> wrote: > > > On Thu, May 14, 2020 at 7:52 AM 'Michael Lackhoff' via Mojolicious < > mojolicious@googlegroups.com> wrote: > >> When I change the sequence of the form parameters in curl, it fails in >> the same way. So I guess the sequence is important and my question now is: >> Is there a way to pass the form parameters with fixed sequence in M::U >> (the form-hash of course has a random order)? Perhaps as an array? >> > > Good question. Probably what you want then is to override the built-in " > form <https://mojolicious.org/perldoc/Mojo/UserAgent/Transactor#form>" > generator. You can either override (by simply redefining it), or you can > create > your own generator > <https://mojolicious.org/perldoc/Mojolicious/Guides/Cookbook#Content-generators> > and use it. > > $ua->transactor->add_generator(fritz => sub { > my ($t, $tx, $args) = @_; > my ($sid, $pwd, $config) = @$args; > my $sorted_parts = [...]; > $tx->req->content->parts($sorted_parts); > }); > $ua->post('http://fritz.box/cgi-bin/firmwarecfg' => fritz => [$SID, > $BAKPWD, undef]); > > You could use a hash instead of an array for your fritz args if you wanted > to, and still pull out the pieces you want to assemble the array as > desired. It's very flexible. > > But since you're currently using the "form" generator and learning a good > deal about it and have determined a solution using the form generator, you > might want to copy the form generator into your own fritz generator and > then do the differences you need to (as you wished). Or you might be able > to simplify it and just do the content->parts as you alluded to. > TMTOWTDI! :D > > -- > 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 mojolicious+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/mojolicious/CACyQ%2BFRSawHXv92ScBL8nc2U_dWVFWwD5KnLqwjCvtKdX8eaPg%40mail.gmail.com > <https://groups.google.com/d/msgid/mojolicious/CACyQ%2BFRSawHXv92ScBL8nc2U_dWVFWwD5KnLqwjCvtKdX8eaPg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- 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 mojolicious+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/mojolicious/CABMkAVWK%3Dki20sC_fhzQpWskD9qrB0qygZuJWMTp2Zsy1zewdw%40mail.gmail.com.