r66005 - in /trunk/libtest-tcp-perl: Changes META.yml debian/changelog lib/Test/TCP.pm

carnil at users.alioth.debian.org carnil at users.alioth.debian.org
Sun Dec 19 18:23:30 UTC 2010


Author: carnil
Date: Sun Dec 19 18:23:09 2010
New Revision: 66005

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=66005
Log:
* Team upload.
* New upstream release

Modified:
    trunk/libtest-tcp-perl/Changes
    trunk/libtest-tcp-perl/META.yml
    trunk/libtest-tcp-perl/debian/changelog
    trunk/libtest-tcp-perl/lib/Test/TCP.pm

Modified: trunk/libtest-tcp-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-tcp-perl/Changes?rev=66005&op=diff
==============================================================================
--- trunk/libtest-tcp-perl/Changes (original)
+++ trunk/libtest-tcp-perl/Changes Sun Dec 19 18:23:09 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: trunk/libtest-tcp-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-tcp-perl/META.yml?rev=66005&op=diff
==============================================================================
--- trunk/libtest-tcp-perl/META.yml (original)
+++ trunk/libtest-tcp-perl/META.yml Sun Dec 19 18:23:09 2010
@@ -24,4 +24,4 @@
   perl: 5.8.0
 resources:
   license: http://dev.perl.org/licenses/
-version: 1.08
+version: 1.10

Modified: trunk/libtest-tcp-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-tcp-perl/debian/changelog?rev=66005&op=diff
==============================================================================
--- trunk/libtest-tcp-perl/debian/changelog (original)
+++ trunk/libtest-tcp-perl/debian/changelog Sun Dec 19 18:23:09 2010
@@ -1,3 +1,10 @@
+libtest-tcp-perl (1.10-1) UNRELEASED; urgency=low
+
+  * Team upload.
+  * New upstream release
+
+ -- Salvatore Bonaccorso <carnil at debian.org>  Sun, 19 Dec 2010 19:22:51 +0100
+
 libtest-tcp-perl (1.08-1) unstable; urgency=low
 
   * Team upload.

Modified: trunk/libtest-tcp-perl/lib/Test/TCP.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-tcp-perl/lib/Test/TCP.pm?rev=66005&op=diff
==============================================================================
--- trunk/libtest-tcp-perl/lib/Test/TCP.pm (original)
+++ trunk/libtest-tcp-perl/lib/Test/TCP.pm Sun Dec 19 18:23:09 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