Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi, Monks!

This line of code that extracts all viewers/lurkers online in a twitch IRC chat, works fine on W10, but not on Debian... any idea why?

#!/usr/bin/perl use Mojo::UserAgent; sub chatters { my $url = "https://tmi.twitch.tv/group/user/bobross/chatters"; return unless my $data = Mojo::UserAgent->new->get($url)->res->jso +n; map { @$_ } values %{ $data->{chatters} }; } @users = chatters(); print "@users\n";

Replies are listed 'Best First'.
Re: Works on W10, but not on Debian
by haukex (Archbishop) on Jan 07, 2018 at 19:17 UTC

    Perhaps IO::Socket::SSL isn't installed? (It comes preinstalled with Strawberry Perl.) If you're using the system Perl, try sudo apt-get install libio-socket-ssl-perl, otherwise try cpan IO::Socket::SSL (you might need to do sudo apt-get build-dep libio-socket-ssl-perl).

    Update: Added a bit more info.

Re: Works on W10, but not on Debian
by marto (Cardinal) on Jan 07, 2018 at 19:19 UTC
Re: Works on W10, but not on Debian
by morgon (Priest) on Jan 07, 2018 at 19:07 UTC
    What about some error checking/reporting?

    The get method returns an object that has an error method. Looking at that should give some hint.

    I would assume you have some certificate problem as you access an https-url.

Re: Works on W10, but not on Debian
by Anonymous Monk on Jan 08, 2018 at 00:48 UTC
    I removed the "s" in "https" and now it works.

      So the advice regards SSL would seem to be correct. It's important to try and ensure that your perl environments are the same (or as similar as feasibly possible).

Re: Works on W10, but not on Debian
by Anonymous Monk on Jan 08, 2018 at 15:14 UTC
    Also, if you have an error-indicator available after an operation, check that indicator and die if something is wrong ... unless you have an option to tell the package to throw-up for you. That's sometimes the only way that you can be aware that something has failed to work.