1 diff -ur Net-Z3950-ZOOM-1.24/t/16-packages.t Net-Z3950-ZOOM-1.24-networkcheck/t/16-packages.t
2 --- Net-Z3950-ZOOM-1.24/t/16-packages.t 2006-04-12 07:30:09.000000000 -0500
3 +++ Net-Z3950-ZOOM-1.24-networkcheck/t/16-packages.t 2008-09-12 09:29:21.000000000 -0500
8 -use Test::More tests => 40;
11 -BEGIN { use_ok('Net::Z3950::ZOOM') };
12 +use Net::Z3950::ZOOM;
14 +my $number_of_tests = 39;
16 # We will create, and destroy, a new database with a random name
17 my $host = "test.indexdata.com:2118";
18 my $dbname = join("", map { chr(ord("a") + int(rand(26))) } 1..10);
20 +# check to see if the server is unreachable. If so, we skip these tests
21 +if ( server_reachable( $host ) ) {
22 + plan tests => $number_of_tests;
24 + plan skip_all => "host '$host' is unreachable. Network problem?";
27 # Connect anonymously, and expect this to fail
28 my $conn = makeconn($host, undef, undef, 1011);
35 +=head2 server_reachable
37 +returns true if the server is reachable.
39 +pass in the hostname or hostname:port string.
41 +returns 1 if reachable
42 +returns undef if not.
46 +sub server_reachable {
49 + # connection_timeout errorcode
50 + my $connection_timeout = 10007;
52 + my($errcode, $errmsg, $addinfo) = (undef, "dummy", "dummy");
54 + my $conn = Net::Z3950::ZOOM::connection_create( Net::Z3950::ZOOM::options_create() );
55 + $errcode = Net::Z3950::ZOOM::connection_error($conn, $errmsg, $addinfo);
58 + Net::Z3950::ZOOM::connection_connect($conn, $host, 0);
59 + $errcode = Net::Z3950::ZOOM::connection_error($conn, $errmsg, $addinfo);
60 + return if ( $errcode == $connection_timeout );
63 diff -ur Net-Z3950-ZOOM-1.24/t/26-packages.t Net-Z3950-ZOOM-1.24-networkcheck/t/26-packages.t
64 --- Net-Z3950-ZOOM-1.24/t/26-packages.t 2006-06-07 04:58:56.000000000 -0500
65 +++ Net-Z3950-ZOOM-1.24-networkcheck/t/26-packages.t 2008-09-12 09:11:45.000000000 -0500
70 -use Test::More tests => 40;
73 -BEGIN { use_ok('ZOOM') };
76 +my $number_of_tests = 39;
78 # We will create, and destroy, a new database with a random name
79 my $host = "test.indexdata.com:2118";
80 my $dbname = join("", map { chr(ord("a") + int(rand(26))) } 1..10);
82 +# check to see if the server is unreachable. If so, we skip these tests
83 +if ( server_reachable( $host ) ) {
84 + plan tests => $number_of_tests;
86 + plan skip_all => "host '$host' is unreachable. Network problem?";
89 # Connect anonymously, and expect this to fail
90 my $conn = makeconn($host, undef, undef, 1011);
96 +sub server_reachable {
99 + # connection_timeout errorcode
100 + my $connection_timeout = 10007;
102 + my $options = new ZOOM::Options();
105 + eval { $conn = create ZOOM::Connection($options) };
106 + return unless !$@ eq "unconnected connection object created";
108 + eval { $conn->connect($host, 0) };
109 + my($errcode, $errmsg, $addinfo) = maybe_error($@);
110 + return if ( $errcode == $connection_timeout );
115 # To investigate the set of databases created, use Explain Classic: