Skip to content

Commit

Permalink
Net-Ping no indirects
Browse files Browse the repository at this point in the history
  • Loading branch information
atoomic committed Jul 8, 2020
1 parent 2018bb7 commit 9e5ecda
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion dist/Net-Ping/t/110_icmp_inst.t
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ BEGIN {use_ok('Net::Ping')};
SKIP: {
skip "icmp ping requires root privileges.", 1
unless &Net::Ping::_isroot;
my $p = new Net::Ping "icmp";
my $p = Net::Ping->new( "icmp" );
isa_ok($p, 'Net::Ping', 'object can be instantiated for icmp protocol');
}
2 changes: 1 addition & 1 deletion dist/Net-Ping/t/120_udp_inst.t
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ BEGIN {
use Test::More tests => 2;
BEGIN {use_ok 'Net::Ping'};

my $p = new Net::Ping "udp";
my $p = Net::Ping->new( "udp" );
isa_ok($p, 'Net::Ping', 'object can be instantiated for udp protocol');
2 changes: 1 addition & 1 deletion dist/Net-Ping/t/130_tcp_inst.t
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ BEGIN {
use Test::More tests => 2;
BEGIN {use_ok 'Net::Ping'};

my $p = new Net::Ping "tcp";
my $p = Net::Ping->new( "tcp" );
isa_ok($p, 'Net::Ping', 'object can be instantiated for tcp protocol');
2 changes: 1 addition & 1 deletion dist/Net-Ping/t/140_stream_inst.t
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ BEGIN {
use Test::More tests => 2;
BEGIN {use_ok 'Net::Ping'};

my $p = new Net::Ping "stream";
my $p = Net::Ping->new( "stream" );
isa_ok($p, 'Net::Ping', 'object can be instantiated for stream protocol');
2 changes: 1 addition & 1 deletion dist/Net-Ping/t/150_syn_inst.t
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ BEGIN {
use Test::More tests => 2;
BEGIN {use_ok 'Net::Ping'};

my $p = new Net::Ping "syn";
my $p = Net::Ping->new( "syn" );
isa_ok($p, 'Net::Ping', 'object can be instantiated for syn protocol');
18 changes: 9 additions & 9 deletions dist/Net-Ping/t/450_service.t
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@ BEGIN {use_ok('Net::Ping')};
# for the TCP Server stuff instead of doing
# all that direct socket() junk manually.

my $sock1 = new IO::Socket::INET
my $sock1 = IO::Socket::INET->new(
LocalAddr => "127.0.0.1",
Proto => "tcp",
Listen => 8,
or warn "bind: $!";
) or warn "bind: $!";

isa_ok($sock1, 'IO::Socket::INET',
'Start a TCP listen server on ephemeral port');

# Start listening on another ephemeral port
my $sock2 = new IO::Socket::INET
my $sock2 = IO::Socket::INET->new(
LocalAddr => "127.0.0.1",
Proto => "tcp",
Listen => 8,
or warn "bind: $!";
) or warn "bind: $!";

isa_ok($sock2, 'IO::Socket::INET',
'Start a second TCP listen server on ephemeral port');
Expand All @@ -62,7 +62,7 @@ $sock2->close;
#####
# First, we test using the "tcp" protocol.
# (2 seconds should be long enough to connect to loopback.)
my $p = new Net::Ping "tcp", 2;
my $p = Net::Ping->new( "tcp", 2 );

isa_ok($p, 'Net::Ping', 'new() worked');

Expand Down Expand Up @@ -99,7 +99,7 @@ isnt($p->ping("127.0.0.1"), 2, 'second service is off');

#####
# Lastly, we test using the "syn" protocol.
$p = new Net::Ping "syn", 2;
$p = Net::Ping->new( "syn", 2 );

isa_ok($p, 'Net::Ping', 'new() worked');

Expand All @@ -116,7 +116,7 @@ is($p->ack(), undef, 'No more sockets');

###
# Get a fresh object
$p = new Net::Ping "syn", 2;
$p = Net::Ping->new( "syn", 2 );

isa_ok($p, 'Net::Ping', 'new() worked');

Expand All @@ -142,7 +142,7 @@ is($p->ack(), undef, 'No more sockets');

###
# Get a fresh object
$p = new Net::Ping "syn", 2;
$p = Net::Ping->new( "syn", 2 );

isa_ok($p, 'Net::Ping', 'new() worked');

Expand All @@ -160,7 +160,7 @@ is($p->ack(), undef, 'No more sockets');

###
# Get a fresh object
$p = new Net::Ping "syn", 2;
$p = Net::Ping->new( "syn", 2 );

isa_ok($p, 'Net::Ping', 'new() worked');

Expand Down
2 changes: 1 addition & 1 deletion dist/Net-Ping/t/500_ping_icmp.t
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ if ( 0 && !Net::Ping::_isroot()) { # disable in blead via 7bfdd8260c
SKIP: {
skip "icmp ping requires root privileges.", 2
if !Net::Ping::_isroot() or $^O eq 'MSWin32';
my $p = new Net::Ping "icmp";
my $p = Net::Ping->new( "icmp" );
is($p->message_type(), 'echo', "default icmp message type is 'echo'");
# message_type fails on wrong message type
eval {
Expand Down
2 changes: 1 addition & 1 deletion dist/Net-Ping/t/501_ping_icmpv6.t
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if (0 && !Net::Ping::_isroot()) {
SKIP: {
skip "icmpv6 ping requires root privileges.", 1
if !Net::Ping::_isroot() or $^O eq 'MSWin32';
my $p = new Net::Ping "icmpv6";
my $p = Net::Ping->new( "icmpv6" );
# message_type can't be used
eval {
$p->message_type();
Expand Down
2 changes: 1 addition & 1 deletion dist/Net-Ping/t/510_ping_udp.t
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ SKIP: {
skip "udp ping blocked by Window's default settings", 2 if isWindowsVista();
skip "No getprotobyname", 2 unless $Config{d_getpbyname};
skip "Not allowed on $^O", 2 if $^O =~ /^(hpux|irix|aix|freebsd)$/;
my $p = new Net::Ping "udp";
my $p = Net::Ping->new( "udp" );
# message_type can't be used
eval {
$p->message_type();
Expand Down
12 changes: 6 additions & 6 deletions dist/Net-Ping/t/520_icmp_ttl.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ BEGIN {use_ok('Net::Ping')};
SKIP: {
skip "icmp ping requires root privileges.", 1
if !Net::Ping::_isroot() or $^O eq 'MSWin32';
my $p = new Net::Ping ("icmp",undef,undef,undef,undef,undef);
my $p = Net::Ping->new("icmp",undef,undef,undef,undef,undef);
isa_ok($p, 'Net::Ping');
ok $p->ping("127.0.0.1");
$p->close();
$p = new Net::Ping ("icmp",undef,undef,undef,undef,0);
$p = Net::Ping->new("icmp",undef,undef,undef,undef,0);
ok $p->ping("127.0.0.1");
$p->close();
$p = undef();
$p = new Net::Ping ("icmp",undef,undef,undef,undef,1);
$p = Net::Ping->new("icmp",undef,undef,undef,undef,1);
isa_ok($p, 'Net::Ping');
$p = undef();
$p = eval 'new Net::Ping ("icmp",undef,undef,undef,undef,-1)';
$p = eval 'Net::Ping->new("icmp",undef,undef,undef,undef,-1)';
ok(!defined($p));
$p = undef();
$p = eval 'new Net::Ping ("icmp",undef,undef,undef,undef,256)';
$p = eval 'Net::Ping->new("icmp",undef,undef,undef,undef,256)';
ok(!defined($p));
$p = new Net::Ping ("icmp",undef,undef,undef,undef,10);
$p = Net::Ping->new("icmp",undef,undef,undef,undef,10);
ok $p->ping("127.0.0.1");
$p->close();
}

0 comments on commit 9e5ecda

Please sign in to comment.