r66003 - in /branches/upstream/libtest-tcp-perl/current: Changes META.yml lib/Test/TCP.pm
carnil at users.alioth.debian.org
carnil at users.alioth.debian.org
Sun Dec 19 18:20:46 UTC 2010
Author: carnil
Date: Sun Dec 19 18:20:18 2010
New Revision: 66003
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=66003
Log:
[svn-upgrade] new version libtest-tcp-perl (1.10)
Modified:
branches/upstream/libtest-tcp-perl/current/Changes
branches/upstream/libtest-tcp-perl/current/META.yml
branches/upstream/libtest-tcp-perl/current/lib/Test/TCP.pm
Modified: branches/upstream/libtest-tcp-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-tcp-perl/current/Changes?rev=66003&op=diff
==============================================================================
--- branches/upstream/libtest-tcp-perl/current/Changes (original)
+++ branches/upstream/libtest-tcp-perl/current/Changes Sun Dec 19 18:20:18 2010
@@ -1,4 +1,12 @@
Revision history for Perl extension Test::TCP
+
+1.10
+
+ - added Test::TCP->stop method
+
+1.09
+
+ - added document in FAQ section
1.08
Modified: branches/upstream/libtest-tcp-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-tcp-perl/current/META.yml?rev=66003&op=diff
==============================================================================
--- branches/upstream/libtest-tcp-perl/current/META.yml (original)
+++ branches/upstream/libtest-tcp-perl/current/META.yml Sun Dec 19 18:20:18 2010
@@ -24,4 +24,4 @@
perl: 5.8.0
resources:
license: http://dev.perl.org/licenses/
-version: 1.08
+version: 1.10
Modified: branches/upstream/libtest-tcp-perl/current/lib/Test/TCP.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-tcp-perl/current/lib/Test/TCP.pm?rev=66003&op=diff
==============================================================================
--- branches/upstream/libtest-tcp-perl/current/lib/Test/TCP.pm (original)
+++ branches/upstream/libtest-tcp-perl/current/lib/Test/TCP.pm Sun Dec 19 18:20:18 2010
@@ -2,7 +2,7 @@
use strict;
use warnings;
use 5.00800;
-our $VERSION = '1.08';
+our $VERSION = '1.10';
use base qw/Exporter/;
use IO::Socket::INET;
use Test::SharedFork 0.12;
@@ -120,7 +120,7 @@
}
}
-sub DESTROY {
+sub stop {
my $self = shift;
return unless defined $self->{pid};
@@ -142,6 +142,12 @@
last LOOP;
}
}
+ undef $self->{pid};
+}
+
+sub DESTROY {
+ my $self = shift;
+ $self->stop();
}
1;
@@ -259,6 +265,10 @@
=item $server->start()
Start the server process. Normally, you don't need to call this method.
+
+=item $server->stop()
+
+Stop the server process.
=item my $pid = $server->pid();
@@ -312,6 +322,36 @@
# your client code here.
...
+=item How do you test server program written in other languages like memcached?
+
+You can use C<exec()> in child process.
+
+ use strict;
+ use warnings;
+ use utf8;
+ use Test::More;
+ use Test::TCP 1.08;
+ use File::Which;
+
+ my $bin = scalar which 'memcached';
+ plan skip_all => 'memcached binary is not found' unless defined $bin;
+
+ my $memcached = Test::TCP->new(
+ code => sub {
+ my $port = shift;
+
+ exec $bin, '-p' => $port;
+ die "cannot execute $bin: $!";
+ },
+ );
+
+ use Cache::Memcached;
+ my $memd = Cache::Memcached->new({servers => ['127.0.0.1:' . $memcached->port]});
+ $memd->set(foo => 'bar');
+ is $memd->get('foo'), 'bar';
+
+ done_testing;
+
=back
=head1 AUTHOR
More information about the Pkg-perl-cvs-commits
mailing list