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.

I uploaded Test::RequiresInternet shortly before game night and its available on CPAN (also Github.) I just haven't gotten around to publicizing it a bit until I was back from Florida.

That means you can now write your test like this:

use Test::More;
use Test::RequiresInternet ( 'fluxcapacitor.io' => 1953 );

# I got Internet!



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.


Leave a comment

About Mark Allen

user-pic Singer, dad, nerd, not necessarily in that order. @bytemeorg