Re: [Mojolicious] Undefined address for Socket::pack_sockaddr_in

2019-12-10 Thread Veesh Goldman
can you show the command you used to start the server?

On Wed, Dec 11, 2019 at 12:08 AM Pavel Serikov 
wrote:

> I got a strange error when make GET request to Mojo server using curl:
>
> Undefined address for Socket::pack_sockaddr_in at
>> /usr/lib/perl5/core_perl/Socket.pm line 851.
>>
>
> Same error I got when running server under morbo and under daemon mode.
>
> What's wrong?
>
> Notice: mojo server is running in docker container.
>
> Mojolicious version : 8.27
>
> --
> 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/822482f8-d186-41a8-948a-98925cc2b68c%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 mojolicious+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mojolicious/CAO-W_8BB8zRhLSGyAWoaO62fLw4wWKw-Xb%3DnkZQR51wHjjfHJw%40mail.gmail.com.


[Mojolicious] Undefined address for Socket::pack_sockaddr_in

2019-12-10 Thread Pavel Serikov
I got a strange error when make GET request to Mojo server using curl:

Undefined address for Socket::pack_sockaddr_in at 
> /usr/lib/perl5/core_perl/Socket.pm line 851.
>

Same error I got when running server under morbo and under daemon mode.

What's wrong?

Notice: mojo server is running in docker container.

Mojolicious version : 8.27

-- 
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/822482f8-d186-41a8-948a-98925cc2b68c%40googlegroups.com.


Re: [Mojolicious] libcurl via Mojolicious

2019-12-10 Thread Felipe Gasper



> Le 10 déc. 2019 à 14:08, Sebastian Riedel  a écrit :
> 
>>> Another big disadvantage is that it doesn't use Mojo::Promise. I don't 
>>> think it will attract too many Mojo users without.
>> 
>> The latest version does, actually.
> 
> Ah, nice. Then you can simplify your example too.
> 
>my $promiser = Net::Curl::Promiser::Mojo->new();
> 
>my $handle = Net::Curl::Easy->new();
>$handle->setopt(CURLOPT_URL() => $url);
> 
>$promiser->add_handle($handle)->then(
>  sub { print "$url completed.$/" },
>  sub { warn "$url failed: " . shift },
>)->wait;
> 
> And if you really want to conform to the Mojo style you rename
> add_handle to add_handle_p, because we like to make promise
> returning methods obvious. ;)

Ah, a nice convention!

I’ll add an “add_handle_p()” alias, update the example, and make another 
release.

-F

-- 
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/EA07C296-B400-4E3D-8DA3-DD8CFF5247D1%40felipegasper.com.


Re: [Mojolicious] libcurl via Mojolicious

2019-12-10 Thread Sebastian Riedel
> > Another big disadvantage is that it doesn't use Mojo::Promise. I don't 
> > think it will attract too many Mojo users without.
>
> The latest version does, actually.

Ah, nice. Then you can simplify your example too.

my $promiser = Net::Curl::Promiser::Mojo->new();

my $handle = Net::Curl::Easy->new();
$handle->setopt(CURLOPT_URL() => $url);

$promiser->add_handle($handle)->then(
  sub { print "$url completed.$/" },
  sub { warn "$url failed: " . shift },
)->wait;

And if you really want to conform to the Mojo style you rename
add_handle to add_handle_p, because we like to make promise
returning methods obvious. ;)

-- 
Sebastian

-- 
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/CANn9nhFX%2BA7gFmZAL3z67zNN2%3DNi1rOkhuhEauu9ZJ_hBhfFMA%40mail.gmail.com.


Re: [Mojolicious] libcurl via Mojolicious

2019-12-10 Thread Felipe Gasper



> Le 10 déc. 2019 à 13:57, sri  a écrit :
> 
> 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. 
> 
> Another big disadvantage is that it doesn't use Mojo::Promise. I don't think 
> it will attract too many Mojo users without.

The latest version does, actually.

-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 mojolicious+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mojolicious/E314D59E-D507-4C58-94E6-BF7B06D847AF%40felipegasper.com.


Re: [Mojolicious] libcurl via Mojolicious

2019-12-10 Thread sri

>
> 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. 
>

Another big disadvantage is that it doesn't use Mojo::Promise. I don't 
think it will attract too many Mojo users without.

--
sebastian 

-- 
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/e3ac046d-1942-46a4-a329-f303fb4e0950%40googlegroups.com.


Re: [Mojolicious] libcurl via Mojolicious

2019-12-10 Thread Felipe Gasper
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  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  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 mojolicious+unsubscr...@googlegroups.com.
> 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 mojolicious+unsubscr...@googlegroups.com.
> 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 mojolicious+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mojolicious/9966E38E-4539-409D-AF31-C2397EBED4A7%40felipegasper.com.


Re: [Mojolicious] libcurl via Mojolicious

2019-12-10 Thread Stefan Adams
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  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 mojolicious+unsubscr...@googlegroups.com.
> 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 mojolicious+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mojolicious/CACyQ%2BFTQyKHHKe1OLaCkfxdN%2B-SgkKtbMq18q93w8FOFdKox0A%40mail.gmail.com.


[Mojolicious] libcurl via Mojolicious

2019-12-10 Thread Felipe Gasper
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 mojolicious+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mojolicious/856af456-b0d4-4638-9eca-9661f02bb555%40googlegroups.com.