@@ -1,17 +0,0 @@
-META.yml
-Makefile
-blib/
-inc/
-pm_to_blib
-*.sw[po]
-^\.git/
-MANIFEST.bak
-*.old
-MYMETA.yml
-/test-tcp-*
-/.build
-/_build_params
-/Build
-!Build/
-!META.json
-/Test-TCP-*
@@ -1,5 +0,0 @@
-language: perl
-before_install:
- - cpanm inc::Module::Install Module::Install::AuthorTests
-perl:
- - "5.14"
@@ -1,18 +1,21 @@
+# =========================================================================
+# THIS FILE IS AUTOMATICALLY GENERATED BY MINILLA.
+# DO NOT EDIT DIRECTLY.
+# =========================================================================
+
+use 5.008_001;
+
use strict;
+use warnings;
+use utf8;
+
use Module::Build;
use File::Basename;
use File::Spec;
use CPAN::Meta;
use CPAN::Meta::Prereqs;
-# =========================================================================
-# THIS FILE IS AUTOMATICALLY GENERATED BY MINILLA.
-# DO NOT EDIT DIRECTLY.
-# =========================================================================
-
-use 5.008;
-
-my $builder = Module::Build->new(
+my %args = (
license => 'perl',
dynamic_config => 0,
@@ -20,15 +23,30 @@ my $builder = Module::Build->new(
'Module::Build' => 0.38,
},
- no_index => { 'directory' => [ 'inc' ] },
- name => 'Test-TCP',
- module_name => 'Test::TCP',
+ name => 'Test-TCP',
+ module_name => 'Test::TCP',
+ allow_pure_perl => 0,
script_files => [glob('script/*'), glob('bin/*')],
test_files => ((-d '.git' || $ENV{RELEASE_TESTING}) && -d 'xt') ? 't/ xt/' : 't/',
recursive_test_files => 1,
);
+if (-d 'share') {
+ $args{share_dir} = 'share';
+}
+
+my $builder = Module::Build->subclass(
+ class => 'MyBuilder',
+ code => q{
+ sub ACTION_distmeta {
+ die "Do not run distmeta. Install Minilla and `minil install` instead.\n";
+ }
+ sub ACTION_installdeps {
+ die "Do not run installdeps. Run `cpanm --installdeps .` instead.\n";
+ }
+ }
+)->new(%args);
$builder->create_build_script();
my $mbmeta = CPAN::Meta->load_file('MYMETA.json');
@@ -1,5 +1,13 @@
Revision history for Perl extension Test::TCP
+1.27 2013-05-15T10:13:18Z
+
+ - export wait_port from Net::EmptyPort
+ (Pavel Shaydo)
+ - Make default wait_port() sleeping time shorter.
+ 0.1sec => 0.0001sec.
+ (tokuhirom)
+
1.26 2013-03-29T08:46:20Z
- Remove unused deps from cpanfile.
@@ -1,5 +1,3 @@
-.gitignore
-.travis.yml
Build.PL
Changes
LICENSE
@@ -20,8 +18,10 @@ t/07_optional.t
t/08_exit.t
t/09_fork.t
t/10_oo.t
+t/11_net_empty_port.t
t/Server.pm
xt/02_perlcritic.t
xt/04_dependents.t
xt/author/11_net_emptyport.t
-xt/perlcriticrc
\ No newline at end of file
+META.yml
+MANIFEST
\ No newline at end of file
@@ -4,39 +4,56 @@
"Tokuhiro Matsuno <[email protected]>"
],
"dynamic_config" : 0,
- "generated_by" : "Minilla/v0.0.49",
+ "generated_by" : "Minilla/v0.4.2",
"license" : "perl_5",
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : "2"
},
"name" : "Test-TCP",
+ "no_index" : {
+ "directory" : [
+ "t",
+ "xt",
+ "inc",
+ "share",
+ "eg",
+ "examples",
+ "author"
+ ]
+ },
"prereqs" : {
- "build" : {
- "requires" : {
- "Test::More" : "0.98"
- }
- },
"configure" : {
"requires" : {
"CPAN::Meta" : "0",
+ "CPAN::Meta::Prereqs" : "0",
"Module::Build" : "0.38"
}
},
"develop" : {
"requires" : {
- "Pod::Wordlist::hanekomu" : "0",
+ "Perl::Critic" : "1.105",
"Test::CPAN::Meta" : "0",
"Test::MinimumVersion" : "0.10108",
+ "Test::Perl::Critic" : "1.02",
"Test::Pod" : "1.41",
- "Test::Spelling" : "0"
+ "Test::Spellunker" : "v0.2.2"
}
},
"runtime" : {
"requires" : {
"IO::Socket::INET" : "0",
+ "Test::More" : "0",
"Test::SharedFork" : "0.19",
- "perl" : "5.00800"
+ "Time::HiRes" : "0",
+ "perl" : "5.008001"
+ }
+ },
+ "test" : {
+ "requires" : {
+ "File::Temp" : "0",
+ "Socket" : "0",
+ "Test::More" : "0.98"
}
}
},
@@ -46,7 +63,7 @@
},
"Test::TCP" : {
"file" : "lib/Test/TCP.pm",
- "version" : "1.26"
+ "version" : "1.27"
},
"Test::TCP::CheckPort" : {
"file" : "lib/Test/TCP/CheckPort.pm"
@@ -63,5 +80,20 @@
"web" : "https://github.com/tokuhirom/Test-TCP"
}
},
- "version" : "1.26"
+ "version" : "1.27",
+ "x_contributors" : [
+ "tokuhirom <tokuhirom@d0d07461-0603-4401-acd4-de1884942a52>",
+ "mattn <mattn@d0d07461-0603-4401-acd4-de1884942a52>",
+ "yappo <yappo@d0d07461-0603-4401-acd4-de1884942a52>",
+ "奥 ä¸Âç© <[email protected]>",
+ "gfx <[email protected]>",
+ "Kenichi Ishigaki <[email protected]>",
+ "lestrrat <[email protected]>",
+ "Masahiro Nagano <[email protected]>",
+ "Thomas Klausner <[email protected]>",
+ "Brendan Byrd <[email protected]>",
+ "Christian Walde <[email protected]>",
+ "Tatsuhiko Miyagawa <[email protected]>",
+ "Pavel Shaydo <[email protected]>"
+ ]
}
@@ -3,33 +3,61 @@ abstract: 'testing TCP program'
author:
- 'Tokuhiro Matsuno <[email protected]>'
build_requires:
+ File::Temp: 0
+ Socket: 0
Test::More: 0.98
configure_requires:
CPAN::Meta: 0
+ CPAN::Meta::Prereqs: 0
Module::Build: 0.38
dynamic_config: 0
-generated_by: 'Minilla/v0.0.49, CPAN::Meta::Converter version 2.120921'
+generated_by: 'Minilla/v0.4.2, CPAN::Meta::Converter version 2.120921'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
name: Test-TCP
+no_index:
+ directory:
+ - t
+ - xt
+ - inc
+ - share
+ - eg
+ - examples
+ - author
provides:
Net::EmptyPort:
file: lib/Net/EmptyPort.pm
version: 0
Test::TCP:
file: lib/Test/TCP.pm
- version: 1.26
+ version: 1.27
Test::TCP::CheckPort:
file: lib/Test/TCP/CheckPort.pm
version: 0
requires:
IO::Socket::INET: 0
+ Test::More: 0
Test::SharedFork: 0.19
- perl: 5.00800
+ Time::HiRes: 0
+ perl: 5.008001
resources:
bugtracker: https://github.com/tokuhirom/Test-TCP/issues
homepage: https://github.com/tokuhirom/Test-TCP
repository: git://github.com/tokuhirom/Test-TCP.git
-version: 1.26
+version: 1.27
+x_contributors:
+ - 'tokuhirom <tokuhirom@d0d07461-0603-4401-acd4-de1884942a52>'
+ - 'mattn <mattn@d0d07461-0603-4401-acd4-de1884942a52>'
+ - 'yappo <yappo@d0d07461-0603-4401-acd4-de1884942a52>'
+ - '奥 ä¸Âç© <[email protected]>'
+ - 'gfx <[email protected]>'
+ - 'Kenichi Ishigaki <[email protected]>'
+ - 'lestrrat <[email protected]>'
+ - 'Masahiro Nagano <[email protected]>'
+ - 'Thomas Klausner <[email protected]>'
+ - 'Brendan Byrd <[email protected]>'
+ - 'Christian Walde <[email protected]>'
+ - 'Tatsuhiko Miyagawa <[email protected]>'
+ - 'Pavel Shaydo <[email protected]>'
@@ -1,7 +1,17 @@
-requires 'perl', '5.00800';
+requires 'perl', 5.008_001;
requires 'IO::Socket::INET';
requires 'Test::SharedFork', '0.19';
+requires 'Test::More';
+requires 'Time::HiRes';
-on build => sub {
+on test => sub {
requires 'Test::More', '0.98';
+ requires 'File::Temp';
+ requires 'Socket';
+};
+
+
+on develop => sub {
+ requires 'Perl::Critic', '1.105';
+ requires 'Test::Perl::Critic', '1.02';
};
@@ -5,7 +5,7 @@ use base qw/Exporter/;
use IO::Socket::INET;
use Time::HiRes ();
-our @EXPORT = qw/ empty_port check_port /;
+our @EXPORT = qw/ empty_port check_port wait_port /;
# get a empty port on 49152 .. 65535
# http://www.iana.org/assignments/port-numbers
@@ -112,7 +112,7 @@ Net::EmptyPort helps finding an empty TCP/UDP port.
=over 4
-=item empty_port
+=item C<< empty_port() >>
my $port = empty_port();
@@ -133,7 +133,7 @@ the second parameter:
# use 49152..65535 range
my $port = empty_port(undef, 'udp');
-=item check_port
+=item C<< check_port($port:Int) >>
my $true_or_false = check_port(5000);
@@ -143,7 +143,7 @@ Also works for UDP:
my $true_or_false = check_port(5000, 'udp');
-=item wait_port($port:Int[, $sleep:Number, $retry:Int, $proto:String])
+=item C<< wait_port($port:Int[, $sleep:Number, $retry:Int, $proto:String]) >>
Waits for a particular port is available for connect.
@@ -2,7 +2,7 @@ package Test::TCP;
use strict;
use warnings;
use 5.00800;
-our $VERSION = '1.26';
+our $VERSION = '1.27';
use base qw/Exporter/;
use IO::Socket::INET;
use Test::SharedFork 0.12;
@@ -34,7 +34,7 @@ sub test_tcp {
sub wait_port {
my $port = shift;
- Net::EmptyPort::wait_port($port, 0.1, 100)
+ Net::EmptyPort::wait_port($port, 0.001, 100)
or die "cannot open port: $port";
}
@@ -128,6 +128,8 @@ sub DESTROY {
1;
__END__
+=for stopwords OO-ish
+
=encoding utf8
=head1 NAME
@@ -0,0 +1,18 @@
+use strict;
+use warnings;
+use Test::More;
+use Net::EmptyPort;
+
+my $port = empty_port;
+ok $port, "found an empty port";
+ok !wait_port( $port, 0.1, 1 ), "port is closed";
+
+my $sock = IO::Socket::INET->new(
+ LocalAddr => '127.0.0.1',
+ LocalPort => $port,
+ Listen => 1,
+) or die "Couldn't create socket: $!";
+
+ok wait_port( $port, 2.1, 1 ), "port is open";
+
+done_testing;
@@ -1,5 +1,49 @@
use strict;
+use warnings;
use Test::More;
-eval q{ use Test::Perl::Critic -profile => 'xt/perlcriticrc' };
-plan skip_all => "Test::Perl::Critic is not installed." if $@;
-all_critic_ok('lib');
+
+eval {
+ require Perl::Critic;
+ Perl::Critic->VERSION(1.105);
+
+ require Test::Perl::Critic;
+ Test::Perl::Critic->VERSION(1.02);
+ Test::Perl::Critic->import(
+ -profile => \(join q{}, <DATA>)
+ );
+};
+note $@ if $@;
+plan skip_all => "Perl::Critic 1.105+ or Test::Perl::Critic 1.02+ is not installed." if $@;
+
+all_critic_ok('lib', 'script', 'bin');
+
+__END__
+
+only=1
+
+# -------------------------------------------------------------------------
+# Not important.
+
+[BuiltinFunctions::ProhibitSleepViaSelect]
+[BuiltinFunctions::RequireGlobFunction]
+[ClassHierarchies::ProhibitOneArgBless]
+
+# -------------------------------------------------------------------------
+# Bug detection
+[InputOutput::ProhibitBarewordFileHandles]
+[Modules::RequireFilenameMatchesPackage]
+[Subroutines::ProhibitNestedSubs]
+[Subroutines::ProhibitReturnSort]
+[TestingAndDebugging::RequireUseStrict]
+[Variables::ProhibitConditionalDeclarations]
+[Variables::RequireLexicalLoopIterators]
+
+[TestingAndDebugging::ProhibitNoStrict]
+allow=refs
+
+# -------------------------------------------------------------------------
+# Security issue detection
+[InputOutput::RequireEncodingWithUTF8Layer]
+[Modules::ProhibitEvilModules]
+[InputOutput::ProhibitTwoArgOpen]
+
@@ -1,2 +0,0 @@
-[TestingAndDebugging::ProhibitNoStrict]
-allow=refs