Test::RequiresInternet now on CPAN
During my talk at YAPC I recommended that people writing functional tests for a web service client ensure that Internet access is available before running the rest of the test. Later, a question was asked about an easy way to test for Internet access, and I was informed of the existence of Net::Detect.
With a recent thread from CPAN-workers fresh in my memory, I promised to release Test::RequiresInternet to CPAN during YAPC if I was fortunate enough to get through all of it.
That means you can now write your test like this:
use Test::More; use Test::RequiresInternet ( 'fluxcapacitor.io' => 1953 ); # I got Internet! ok(travel_in_time()); done_testing();
Why not just use Net::Detect? I wanted a simple module that uses TAP output and didn't have any dependencies outside of the Perl core. I also wanted to account for the environment variable
NO_NETWORK_TESTING and the syntax I adopted.