1Test::RequiresInternet(U3s)er Contributed Perl DocumentatTieosnt::RequiresInternet(3)
2
3
4
6 Test::RequiresInternet - Easily test network connectivity
7
9 version 0.05
10
12 use Test::More;
13 use Test::RequiresInternet ('www.example.com' => 80, 'foobar.io' => 25);
14
15 # if you reach here, sockets successfully connected to hosts/ports above
16 plan tests => 1;
17
18 ok(do_that_internet_thing());
19
21 This module is intended to easily test network connectivity before
22 functional tests begin to non-local Internet resources. It does not
23 require any modules beyond those supplied in core Perl.
24
25 If you do not specify a host/port pair, then the module defaults to
26 using "www.google.com" on port 80.
27
28 You may optionally specify the port by its name, as in "http" or
29 "ldap". If you do this, the test module will attempt to look up the
30 port number using "getservbyname".
31
32 If you do specify a host and port, they must be specified in pairs. It
33 is a fatal error to omit one or the other.
34
35 If the environment variable "NO_NETWORK_TESTING" is set, then the tests
36 will be skipped without attempting any socket connections.
37
38 If the sockets cannot connect to the specified hosts and ports, the
39 exception is caught, reported and the tests skipped.
40
42 Mark Allen <mrallen1@yahoo.com>
43
45 This software is copyright (c) 2014 by Mark Allen.
46
47 This is free software; you can redistribute it and/or modify it under
48 the same terms as the Perl 5 programming language system itself.
49
50
51
52perl v5.32.0 2020-07-28 Test::RequiresInternet(3)