From: Jarkko Hietaniemi Date: Wed, 26 Dec 2001 17:47:57 +0000 (+0000) Subject: Net::Ping isn't going to work much without X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a2a978ac74e3f07d5ba28e7a4d1f1e4ae67ce129;p=p5sagit%2Fp5-mst-13.2.git Net::Ping isn't going to work much without the Socket extension; fail more gracefully. p4raw-id: //depot/perl@13890 --- diff --git a/lib/Net/Ping/t/100_load.t b/lib/Net/Ping/t/100_load.t index d6a71e0..eff67e3 100644 --- a/lib/Net/Ping/t/100_load.t +++ b/lib/Net/Ping/t/100_load.t @@ -3,6 +3,13 @@ ######################### We start with some black magic to print on failure. +BEGIN { + unless (eval "require Socket") { + print "1..0 # Skip: no Socket\n"; + exit; + } +} + use Test; BEGIN { plan tests => 1; $loaded = 0} END { ok $loaded;} diff --git a/lib/Net/Ping/t/110_icmp_inst.t b/lib/Net/Ping/t/110_icmp_inst.t index 2e67a59..c358dac 100644 --- a/lib/Net/Ping/t/110_icmp_inst.t +++ b/lib/Net/Ping/t/110_icmp_inst.t @@ -1,6 +1,13 @@ # Test to make sure object can be instantiated for icmp protocol. # Root access is required to actually perform icmp testing. +BEGIN { + unless (eval "require Socket") { + print "1..0 # Skip: no Socket\n"; + exit; + } +} + use Test; use Net::Ping; plan tests => 2; diff --git a/lib/Net/Ping/t/120_udp_inst.t b/lib/Net/Ping/t/120_udp_inst.t index ee53bd4..e4a39e4 100644 --- a/lib/Net/Ping/t/120_udp_inst.t +++ b/lib/Net/Ping/t/120_udp_inst.t @@ -1,6 +1,13 @@ # Test to make sure object can be instantiated for udp protocol. # I do not know of any servers that support udp echo anymore. +BEGIN { + unless (eval "require Socket") { + print "1..0 # Skip: no Socket\n"; + exit; + } +} + use Test; use Net::Ping; plan tests => 2; diff --git a/lib/Net/Ping/t/130_tcp_inst.t b/lib/Net/Ping/t/130_tcp_inst.t index 6a547e1..a7cc1d2 100644 --- a/lib/Net/Ping/t/130_tcp_inst.t +++ b/lib/Net/Ping/t/130_tcp_inst.t @@ -1,5 +1,12 @@ # Test to make sure object can be instantiated for tcp protocol. +BEGIN { + unless (eval "require Socket") { + print "1..0 # Skip: no Socket\n"; + exit; + } +} + use Test; use Net::Ping; plan tests => 2; diff --git a/lib/Net/Ping/t/140_stream_inst.t b/lib/Net/Ping/t/140_stream_inst.t index 142f6db..db35a88 100644 --- a/lib/Net/Ping/t/140_stream_inst.t +++ b/lib/Net/Ping/t/140_stream_inst.t @@ -1,5 +1,12 @@ # Test to make sure object can be instantiated for stream protocol. +BEGIN { + unless (eval "require Socket") { + print "1..0 # Skip: no Socket\n"; + exit; + } +} + use Test; use Net::Ping; plan tests => 2; diff --git a/lib/Net/Ping/t/200_ping_tcp.t b/lib/Net/Ping/t/200_ping_tcp.t index 7bdc8e7..f257b0d 100644 --- a/lib/Net/Ping/t/200_ping_tcp.t +++ b/lib/Net/Ping/t/200_ping_tcp.t @@ -7,6 +7,10 @@ BEGIN { chdir 't' if -d 't'; @INC = qw(../lib); } + unless (eval "require Socket") { + print "1..0 # Skip: no Socket\n"; + exit; + } } # Remote network test using tcp protocol. diff --git a/lib/Net/Ping/t/300_ping_stream.t b/lib/Net/Ping/t/300_ping_stream.t index 4c32a64..381e08b 100644 --- a/lib/Net/Ping/t/300_ping_stream.t +++ b/lib/Net/Ping/t/300_ping_stream.t @@ -7,6 +7,10 @@ BEGIN { chdir 't' if -d 't'; @INC = qw(../lib); } + unless (eval "require Socket") { + print "1..0 # Skip: no Socket\n"; + exit; + } } # Test of stream protocol using loopback interface.