diff options
author | Eric Wong <e@80x24.org> | 2019-09-02 04:51:31 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-09-09 01:59:23 +0000 |
commit | 7f3f4923ec711ec97a1204ec2c080e219f50ff3b (patch) | |
tree | 0f15ed7624754eda339fc31d8889ba1407e0241c /t/httpd.t | |
parent | 16d96f80e55d3f40338101ee8641e03f3b4f2d64 (diff) | |
download | public-inbox-7f3f4923ec711ec97a1204ec2c080e219f50ff3b.tar.gz |
IO::Socket::INET->new is rather verbose with the options hash, extract it into a standalone sub
Diffstat (limited to 't/httpd.t')
-rw-r--r-- | t/httpd.t | 8 |
1 files changed, 2 insertions, 6 deletions
@@ -9,8 +9,7 @@ foreach my $mod (qw(Plack::Util Plack::Builder HTTP::Date HTTP::Status)) { plan skip_all => "$mod missing for httpd.t" if $@; } use File::Temp qw/tempdir/; -use IO::Socket::INET; -use Socket qw(IPPROTO_TCP); +use Socket qw(IPPROTO_TCP SOL_SOCKET); require './t/common.perl'; # FIXME: too much setup @@ -58,10 +57,7 @@ EOF $pid = spawn_listener(undef, $cmd, [$sock]); my $host = $sock->sockhost; my $port = $sock->sockport; - my $conn = IO::Socket::INET->new(PeerAddr => $host, - PeerPort => $port, - Proto => 'tcp', - Type => SOCK_STREAM); + my $conn = tcp_connect($sock); ok($conn, 'connected'); ok($conn->write("GET / HTTP/1.0\r\n\r\n"), 'wrote data to socket'); { |