As such (such being that IO::Socket::INET does not die or set $@ on failure), you'd want one of the following code snippets:
# best solution: $socketA = new IO::Socket::INET( PeerAddr => $A_box_address, PeerPort => $A_box_port, Proto => 'tcp', ) or $skipA = 1; # another option: $socketA = new IO::Socket::INET( PeerAddr => $A_box_address, PeerPort => $A_box_port, Proto => 'tcp', ); $skipA = 1 unless defined($socketA); # yet another eval q{ $socketA = new IO::Socket::INET( PeerAddr => $A_box_address, PeerPort => $A_box_port, Proto => 'tcp', ) or die("ouch\n"); }; $skipA = 1 if ($@ eq "ouch\n"); # and still yet... eval q{ $socketA = new IO::Socket::INET ( PeerAddr => $A_box_address, PeerPort => $A_box_port, Proto => 'tcp', ) or die("ouch\n"); } or $skipA = 1;
In reply to Re: IO::Socket *always* making connection?
by saskaqueer
in thread IO::Socket *always* making connection?
by wolfger
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |