| 1 | package pokemon_go_server_status; | ||
| 2 | |||
| 3 | use warnings; | ||
| 4 | use strict; | ||
| 5 | |||
| 6 | our $VERSION = 1.00; | ||
| 7 | |||
| 8 | use WWW::Mechanize::Timed; | ||
| 9 | |||
| 10 | use Exporter 'import'; | ||
| 11 | our @EXPORT = qw( get_server_status ); | ||
| 12 | |||
| 13 | sub get_server_status { | ||
| 14 | my $ua = WWW::Mechanize::Timed->new(); | ||
| 15 | my $result; | ||
| 16 | eval { | ||
| 17 | $ua->get('https://pgorelease.nianticlabs.com/plfe/'); | ||
| 18 | if ($ua->client_elapsed_time < 3) { | ||
| 19 | $result = 'Go! catch them all!'; | ||
| 20 | } else { | ||
| 21 | $result = 'Servers are down, go back to work'; | ||
| 22 | } | ||
| 23 | 1; | ||
| 24 | } or do { | ||
| 25 | $result = 'Go! Cacth them all!'; | ||
| 26 | }; | ||
| 27 | $result | ||
| 28 | } | ||
| 29 | |||
| 30 | 1; |