Permalink
Browse files

s/::OO//; suggested by miyagawa++

  • Loading branch information...
1 parent 25d46f5 commit fcd3b3655af02238ec61f0116938c722c32322a4 @tokuhirom tokuhirom committed Dec 17, 2010
Showing with 14 additions and 14 deletions.
  1. +13 −13 lib/Test/TCP.pm
  2. +1 −1 t/10_oo.t
View
@@ -10,9 +10,13 @@ use Test::More ();
use Config;
use POSIX;
use Time::HiRes ();
+use Carp ();
our @EXPORT = qw/ empty_port test_tcp wait_port /;
+# process does not die when received SIGTERM, on win32.
+my $TERMSIG = $^O eq 'MSWin32' ? 'KILL' : 'TERM';
+
sub empty_port {
my $port = do {
if (@_) {
@@ -43,7 +47,7 @@ sub test_tcp {
for my $k (qw/client server/) {
die "missing madatory parameter $k" unless exists $args{$k};
}
- my $server = Test::TCP::OO->new(
+ my $server = Test::TCP->new(
code => $args{server},
port => $args{port} || empty_port(),
);
@@ -79,12 +83,8 @@ sub wait_port {
die "cannot open port: $port";
}
-package Test::TCP::OO;
-use Config;
-use Carp ();
-
-# process does not die when received SIGTERM, on win32.
-my $TERMSIG = $^O eq 'MSWin32' ? 'KILL' : 'TERM';
+# -------------------------------------------------------------------------
+# OO-ish interface
sub new {
my $class = shift;
@@ -184,7 +184,7 @@ Or, OO-ish interface
use Test::TCP;
- my $server = Test::TCP::OO->new(
+ my $server = Test::TCP->new(
code => sub {
my $port = shift;
...
@@ -230,13 +230,13 @@ Waits for a particular port is available for connect.
=back
-=head1 Test::TCP::OO
+=head1 OO-ish interface
=over 4
-=item my $server = Test::TCP::OO->new(%args);
+=item my $server = Test::TCP->new(%args);
-Create new instance of Test::TCP::OO.
+Create new instance of Test::TCP.
Arguments are following:
@@ -300,11 +300,11 @@ You can call test_tcp() twice!
Or use OO-ish interface instead.
- my $server1 = Test::TCP::OO->new(code => sub {
+ my $server1 = Test::TCP->new(code => sub {
my $port1 = shift;
...
});
- my $server2 = Test::TCP::OO->new(code => sub {
+ my $server2 = Test::TCP->new(code => sub {
my $port2 = shift;
...
});
View
@@ -5,7 +5,7 @@ use Test::TCP;
use IO::Socket::INET;
use t::Server;
-my $server = Test::TCP::OO->new(
+my $server = Test::TCP->new(
code => sub {
my $port = shift;
ok $port, "test case for sharedfork" for 1..10;

0 comments on commit fcd3b36

Please sign in to comment.