Perl Diver 2.31
Main Environment Variables Perl Default Values Perl Config - Summary Perl Config - Full Installed Modules List Directory uptime Docs

Module Documentation
Details and documentation about a specific module, including version and documentation (if available). Note that while links to perldoc.com and search.cpan.org are provided, the module may be part of a larger distribution. If you reach a File Not Found page on either site, please try the parent module.

Test::RequiresInternet

Name Test::RequiresInternet
Version 0.05
Located at /usr/local/share/perl5
File /usr/local/share/perl5/Test/RequiresInternet.pm
Is Core No
Search CPAN for this module Test::RequiresInternet
Documentation Test::RequiresInternet
Module Details Test::RequiresInternet


NAME

Test::RequiresInternet - Easily test network connectivity


VERSION

version 0.05


SYNOPSIS

  use Test::More;
  use Test::RequiresInternet ('www.example.com' => 80, 'foobar.io' => 25);
  # if you reach here, sockets successfully connected to hosts/ports above
  plan tests => 1;
  ok(do_that_internet_thing());


OVERVIEW

This module is intended to easily test network connectivity before functional tests begin to non-local Internet resources. It does not require any modules beyond those supplied in core Perl.

If you do not specify a host/port pair, then the module defaults to using www.google.com on port 80.

You may optionally specify the port by its name, as in http or ldap. If you do this, the test module will attempt to look up the port number using getservbyname.

If you do specify a host and port, they must be specified in pairs. It is a fatal error to omit one or the other.

If the environment variable NO_NETWORK_TESTING is set, then the tests will be skipped without attempting any socket connections.

If the sockets cannot connect to the specified hosts and ports, the exception is caught, reported and the tests skipped.


AUTHOR

Mark Allen <mrallen1@yahoo.com>


COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Mark Allen.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

Perl Diver brought to you by ScriptSolutions.com © 1997- 2024