(re-ordered for thematic reasons) Thanks all for responses.

It might also be useful to GET your modem's status page. It can tell if your connection from your house or office to your ISP is up or not.

This simple advice came just in time for me to ask the comcast guy the address. It isn't the old 192.0.0.1 it used to be, and the page seems to have more functionality than I recall.

Another option is LWP::Online.

I'd like to unpack this a bit. First, I do have a working script:

$ ./1.lwp.pl execution here execution there $ cat 1.lwp.pl #!/usr/bin/perl use 5.016; use warnings; use LWP::Online 'online'; say "execution here"; # "Is the internet working?" die "NO INTARWWEB!!!" unless online(); say "execution there"; __END__ $

I attempted to dig through a few parts of this listing for Online.pm. I have any number of questions after having contended with the source for several days now. Regarding this snippet:

# Set up configuration data use vars qw{%SUPPORTED @RELIABLE_HTTP}; BEGIN { # What transports do we support %SUPPORTED = map { $_ => 1 } qw{ http }; # (Relatively) reliable websites @RELIABLE_HTTP = ( # These are some initial trivial checks. # The regex are case-sensitive to at least # deal with the "couldn't get site.com case". 'http://www.msftncsi.com/ncsi.txt' => sub { $_ eq 'Mic +rosoft NCSI' }, 'http://google.com/' => sub { /About Goo +gle/ }, 'http://yahoo.com/' => sub { /Yahoo!/ + }, 'http://amazon.com/' => sub { /Amazon/ a +nd /Cart/ }, 'http://cnn.com/' => sub { /CNN/ + }, ); }

What is happening with the subs here?

You get about hip deep in it and need to look at source for LWP::Simple. Is this a core module?

In this snippet from LWP::Online, how does it import a lexical variable?

use LWP::Simple 5.805 qw{ get $ua }; use vars qw{$VERSION @ISA @EXPORT_OK}; BEGIN { $VERSION = '1.08'; # We are an Exporter require Exporter; @ISA = qw{ Exporter }; @EXPORT_OK = qw{ online offline }; # Set the useragent timeout $ua->timeout(30); }

This is get in LWP::Simple

sub get ($) { my $response = $ua->get(shift); return $response->decoded_content if $response->is_success; return undef; }

How would one add his own site to @RELIABLE_HTTP?

Thanks for your comments


In reply to Re^2: writing a utility to determine whether I have a working wifi connection by Aldebaran
in thread writing a utility to determine whether I have a working wifi connection by Aldebaran

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.