Hi Stefan,
The primary advantage I see is that whatever libcurl features that
Net::Curl exposes are now readily usable within Mojo. So libcurl’s http/2
support, for example, should be usable, as would non-HTTP protocols that
libcurl supports like FTP, IMAP, etc. (Possibly even the experimental http/3
support?)
Other potential advantages would be speed (XS/C versus pure Perl) and,
I would think, wider use: as much as Mojo is used in Perl, curl is used
practically everywhere, with bindings in Python, Ruby, Rust, etc.
The disadvantage is that you’ll need to use Net::Curl::Easy, which
isn’t a very Perlish interface. HTTP::AnyUA’s backend for same demonstrates how
to “tame the beast”, though, and Net::Curl’s own documentation is quite helpful
(IMO), so there’s at least copious prior art to reference.
I should disclaim here: I’ve not benchmarked this nor used it very
extensively beyond just verifying that it works for simple parallel GETs. That
said, since Net::Curl::Promiser is fairly simple, and Net::Curl itself has been
around for a while and remains actively maintained, whatever gremlins may still
lurk should be easy to find and fix.
-FG
> Le 10 déc. 2019 à 13:19, Stefan Adams <[email protected]> a écrit :
>
> Hi, Felipe! Thanks for sharing this! What advantages does integrating with
> libcurl have over using Mojo::UserAgent?
>
> On Tue, Dec 10, 2019, 8:41 AM Felipe Gasper <[email protected]> wrote:
> Hi all,
>
> I’ve got a library called Net::Curl::Promiser that does the “dirty-work” of
> interfacing between different event loops and Net::Curl::Multi. I recently
> added a Mojo::IOLoop backend, so it should now be possible to integrate
> libcurl seamlessly into Mojolicious via Net::Curl::Promiser::Mojo.
>
> Hope it’s useful … enjoy!
>
> -FG
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/mojolicious/856af456-b0d4-4638-9eca-9661f02bb555%40googlegroups.com.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/mojolicious/CACyQ%2BFTQyKHHKe1OLaCkfxdN%2B-SgkKtbMq18q93w8FOFdKox0A%40mail.gmail.com.
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/mojolicious/9966E38E-4539-409D-AF31-C2397EBED4A7%40felipegasper.com.