r68973 - in /branches/upstream/libthread-queue-perl/current: ./ examples/ lib/Thread/ t/

periapt-guest at users.alioth.debian.org periapt-guest at users.alioth.debian.org
Fri Feb 18 09:10:39 UTC 2011


Author: periapt-guest
Date: Fri Feb 18 09:10:22 2011
New Revision: 68973

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=68973
Log:
[svn-upgrade] new version libthread-queue-perl (2.12)

Added:
    branches/upstream/libthread-queue-perl/current/examples/callback.pl   (with props)
Modified:
    branches/upstream/libthread-queue-perl/current/Changes
    branches/upstream/libthread-queue-perl/current/MANIFEST
    branches/upstream/libthread-queue-perl/current/META.yml
    branches/upstream/libthread-queue-perl/current/Makefile.PL
    branches/upstream/libthread-queue-perl/current/README
    branches/upstream/libthread-queue-perl/current/lib/Thread/Queue.pm
    branches/upstream/libthread-queue-perl/current/t/01_basic.t
    branches/upstream/libthread-queue-perl/current/t/02_refs.t
    branches/upstream/libthread-queue-perl/current/t/03_peek.t
    branches/upstream/libthread-queue-perl/current/t/04_errs.t
    branches/upstream/libthread-queue-perl/current/t/05_extract.t
    branches/upstream/libthread-queue-perl/current/t/06_insert.t
    branches/upstream/libthread-queue-perl/current/t/07_lock.t
    branches/upstream/libthread-queue-perl/current/t/08_nothreads.t
    branches/upstream/libthread-queue-perl/current/t/99_pod.t

Modified: branches/upstream/libthread-queue-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libthread-queue-perl/current/Changes?rev=68973&op=diff
==============================================================================
--- branches/upstream/libthread-queue-perl/current/Changes (original)
+++ branches/upstream/libthread-queue-perl/current/Changes Fri Feb 18 09:10:22 2011
@@ -1,4 +1,10 @@
 Revision history for Perl extension Thread::Queue.
+
+2.12 Fri Dec 24 17:52:51 2010
+	- Install in 'site' for Perl >= 5.011
+	- Test file changes for core
+	- Added new example (examples/callback.pl) to distribution
+	- POD update
 
 2.11 Thu Jun 12 13:41:45 2008
 	- End all tests with exit(0) and fix SKIPs

Modified: branches/upstream/libthread-queue-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libthread-queue-perl/current/MANIFEST?rev=68973&op=diff
==============================================================================
--- branches/upstream/libthread-queue-perl/current/MANIFEST (original)
+++ branches/upstream/libthread-queue-perl/current/MANIFEST Fri Feb 18 09:10:22 2011
@@ -14,5 +14,6 @@
 t/08_nothreads.t
 t/99_pod.t
 t/test.pl
+examples/callback.pl
 examples/queue.pl
 META.yml                                 Module meta-data (added by MakeMaker)

Modified: branches/upstream/libthread-queue-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libthread-queue-perl/current/META.yml?rev=68973&op=diff
==============================================================================
--- branches/upstream/libthread-queue-perl/current/META.yml (original)
+++ branches/upstream/libthread-queue-perl/current/META.yml Fri Feb 18 09:10:22 2011
@@ -1,17 +1,25 @@
 --- #YAML:1.0
-name:                Thread-Queue
-version:             2.11
-abstract:            Thread-safe queues
-license:             perl
-author:              
+name:               Thread-Queue
+version:            2.12
+abstract:           Thread-safe queues
+author:
     - Jerry D. Hedden <jdhedden AT cpan DOT org>
-generated_by:        ExtUtils::MakeMaker version 6.44
-distribution_type:   module
-requires:     
-    Scalar::Util:                  1.1
-    Test::More:                    0.5
-    Thread::Semaphore:             0
-    threads::shared:               1.21
+license:            perl
+distribution_type:  module
+configure_requires:
+    ExtUtils::MakeMaker:  0
+build_requires:
+    ExtUtils::MakeMaker:  0
+requires:
+    Scalar::Util:       1.1
+    Test::More:         0.5
+    Thread::Semaphore:  0
+    threads::shared:    1.21
+no_index:
+    directory:
+        - t
+        - inc
+generated_by:       ExtUtils::MakeMaker version 6.5601
 meta-spec:
-    url:     http://module-build.sourceforge.net/META-spec-v1.3.html
-    version: 1.3
+    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
+    version:  1.4

Modified: branches/upstream/libthread-queue-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libthread-queue-perl/current/Makefile.PL?rev=68973&op=diff
==============================================================================
--- branches/upstream/libthread-queue-perl/current/Makefile.PL (original)
+++ branches/upstream/libthread-queue-perl/current/Makefile.PL Fri Feb 18 09:10:22 2011
@@ -19,7 +19,7 @@
         'Test::More'        => 0.50,
         'Thread::Semaphore' => 0,
     },
-    'INSTALLDIRS'   => 'perl',
+    'INSTALLDIRS'   => (($] < 5.011) ? 'perl' : 'site'),
 
     ((ExtUtils::MakeMaker->VERSION() lt '6.25') ?
         ('PL_FILES' => { })            : ()),

Modified: branches/upstream/libthread-queue-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libthread-queue-perl/current/README?rev=68973&op=diff
==============================================================================
--- branches/upstream/libthread-queue-perl/current/README (original)
+++ branches/upstream/libthread-queue-perl/current/README Fri Feb 18 09:10:22 2011
@@ -1,4 +1,4 @@
-Thread::Queue version 2.11
+Thread::Queue version 2.12
 ==========================
 
 Thread-safe queues

Added: branches/upstream/libthread-queue-perl/current/examples/callback.pl
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libthread-queue-perl/current/examples/callback.pl?rev=68973&op=file
==============================================================================
--- branches/upstream/libthread-queue-perl/current/examples/callback.pl (added)
+++ branches/upstream/libthread-queue-perl/current/examples/callback.pl Fri Feb 18 09:10:22 2011
@@ -1,0 +1,123 @@
+#!/usr/bin/perl
+
+# Simplified example illustrating event handling and callback threads
+
+# Callback threads register their queues with the event handler thread.
+# Events are passed to the event handler via a queue.
+# The event handler then disseminates the event to the appropriately
+#   registered thread.
+
+use strict;
+use warnings;
+
+use threads;
+use Thread::Queue;
+
+MAIN:
+{
+    # Queue for registering callbacks
+    my $regis_q = Thread::Queue->new();
+
+    # Queue for disseminating events
+    my $event_q = Thread::Queue->new();
+
+    # Create callback threads
+    threads->create('CallBack', 'USR1', $regis_q)->detach();
+    threads->create('CallBack', 'USR2', $regis_q)->detach();
+    threads->create('CallBack', 'HUP', $regis_q)->detach();
+    threads->create('CallBack', 'ALRM', $regis_q)->detach();
+
+    # Create event handler thread
+    threads->create('EventHandler', $regis_q, $event_q)->detach();
+
+    # Capture SIGUSR1 events
+    $SIG{'USR1'} = sub {
+        $event_q->enqueue('USR1');  # Send to event handler
+    };
+
+    # Capture SIGUSR1 events
+    $SIG{'USR2'} = sub {
+        $event_q->enqueue('USR2');  # Send to event handler
+    };
+
+    # Capture SIGHUP events
+    $SIG{'HUP'} = sub {
+        $event_q->enqueue('HUP');  # Send to event handler
+    };
+
+    # Capture SIGHUP events
+    $SIG{'ALRM'} = sub {
+        $event_q->enqueue('ALRM');  # Send to event handler
+        alarm(5);                   # Reset alarm
+    };
+
+    # Ready
+    print(<<_MSG_);
+Send signals to PID = $$
+  (e.g., 'kill -USR1 $$')
+Use ^C (or 'kill -INT $$') to terminate
+_MSG_
+
+    # Set initial alarm
+    alarm(5);
+
+    # Just hang around
+    while (1) {
+        sleep(10);
+    }
+}
+
+### Subroutines ###
+
+sub EventHandler
+{
+    my ($regis_q, $event_q) = @_;
+
+    my %callbacks;   # Registered callback queues
+
+    while (1) {
+        # Check for any registrations
+        while (my ($event_type, $q) = $regis_q->dequeue_nb(2)) {
+            if ($q) {
+                $callbacks{$event_type} = $q;
+            } else {
+                warn("BUG: Bad callback registration for event type $event_type\n");
+            }
+        }
+
+        # Wait for event
+        if (my $event = $event_q->dequeue()) {
+            # Send event to appropriate queue
+            if (exists($callbacks{$event})) {
+                $callbacks{$event}->enqueue($event);
+            } else {
+                warn("WARNING: No callback for event type $event\n");
+            }
+        }
+    }
+}
+
+
+sub CallBack
+{
+    my $event_type = shift;   # The type of event I'm handling
+    my $regis_q    = shift;
+
+    # Announce registration
+    my $tid = threads->tid();
+    print("Callback thread $tid registering for $event_type events\n");
+
+    # Register my queue for my type of event
+    my $q = Thread::Queue->new();
+    $regis_q->enqueue($event_type, $q);
+
+    # Process loop
+    while (1) {
+        # Wait for event callback
+        my $item = $q->dequeue();
+        # Process event
+        print("Callback thread $tid notified of $item event\n") if $item;
+    }
+}
+
+# EOF

Propchange: branches/upstream/libthread-queue-perl/current/examples/callback.pl
------------------------------------------------------------------------------
    svn:executable = *

Modified: branches/upstream/libthread-queue-perl/current/lib/Thread/Queue.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libthread-queue-perl/current/lib/Thread/Queue.pm?rev=68973&op=diff
==============================================================================
--- branches/upstream/libthread-queue-perl/current/lib/Thread/Queue.pm (original)
+++ branches/upstream/libthread-queue-perl/current/lib/Thread/Queue.pm Fri Feb 18 09:10:22 2011
@@ -3,7 +3,8 @@
 use strict;
 use warnings;
 
-our $VERSION = '2.11';
+our $VERSION = '2.12';
+$VERSION = eval $VERSION;
 
 use threads::shared 1.21;
 use Scalar::Util 1.10 qw(looks_like_number blessed reftype refaddr);
@@ -209,7 +210,7 @@
 
 =head1 VERSION
 
-This document describes Thread::Queue version 2.11
+This document describes Thread::Queue version 2.12
 
 =head1 SYNOPSIS
 
@@ -461,12 +462,6 @@
 Thread::Queue Discussion Forum on CPAN:
 L<http://www.cpanforum.com/dist/Thread-Queue>
 
-Annotated POD for Thread::Queue:
-L<http://annocpan.org/~JDHEDDEN/Thread-Queue-2.11/lib/Thread/Queue.pm>
-
-Source repository:
-L<http://code.google.com/p/thread-queue/>
-
 L<threads>, L<threads::shared>
 
 =head1 MAINTAINER

Modified: branches/upstream/libthread-queue-perl/current/t/01_basic.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libthread-queue-perl/current/t/01_basic.t?rev=68973&op=diff
==============================================================================
--- branches/upstream/libthread-queue-perl/current/t/01_basic.t (original)
+++ branches/upstream/libthread-queue-perl/current/t/01_basic.t Fri Feb 18 09:10:22 2011
@@ -2,10 +2,6 @@
 use warnings;
 
 BEGIN {
-    if ($ENV{'PERL_CORE'}){
-        chdir('t');
-        unshift(@INC, '../lib');
-    }
     use Config;
     if (! $Config{'useithreads'}) {
         print("1..0 # SKIP Perl not compiled with 'useithreads'\n");

Modified: branches/upstream/libthread-queue-perl/current/t/02_refs.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libthread-queue-perl/current/t/02_refs.t?rev=68973&op=diff
==============================================================================
--- branches/upstream/libthread-queue-perl/current/t/02_refs.t (original)
+++ branches/upstream/libthread-queue-perl/current/t/02_refs.t Fri Feb 18 09:10:22 2011
@@ -2,10 +2,6 @@
 use warnings;
 
 BEGIN {
-    if ($ENV{'PERL_CORE'}){
-        chdir('t');
-        unshift(@INC, '../lib');
-    }
     use Config;
     if (! $Config{'useithreads'}) {
         print("1..0 # SKIP Perl not compiled with 'useithreads'\n");

Modified: branches/upstream/libthread-queue-perl/current/t/03_peek.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libthread-queue-perl/current/t/03_peek.t?rev=68973&op=diff
==============================================================================
--- branches/upstream/libthread-queue-perl/current/t/03_peek.t (original)
+++ branches/upstream/libthread-queue-perl/current/t/03_peek.t Fri Feb 18 09:10:22 2011
@@ -2,10 +2,6 @@
 use warnings;
 
 BEGIN {
-    if ($ENV{'PERL_CORE'}){
-        chdir('t');
-        unshift(@INC, '../lib');
-    }
     use Config;
     if (! $Config{'useithreads'}) {
         print("1..0 # SKIP Perl not compiled with 'useithreads'\n");

Modified: branches/upstream/libthread-queue-perl/current/t/04_errs.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libthread-queue-perl/current/t/04_errs.t?rev=68973&op=diff
==============================================================================
--- branches/upstream/libthread-queue-perl/current/t/04_errs.t (original)
+++ branches/upstream/libthread-queue-perl/current/t/04_errs.t Fri Feb 18 09:10:22 2011
@@ -1,12 +1,5 @@
 use strict;
 use warnings;
-
-BEGIN {
-    if ($ENV{'PERL_CORE'}){
-        chdir('t');
-        unshift(@INC, '../lib');
-    }
-}
 
 use Thread::Queue;
 

Modified: branches/upstream/libthread-queue-perl/current/t/05_extract.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libthread-queue-perl/current/t/05_extract.t?rev=68973&op=diff
==============================================================================
--- branches/upstream/libthread-queue-perl/current/t/05_extract.t (original)
+++ branches/upstream/libthread-queue-perl/current/t/05_extract.t Fri Feb 18 09:10:22 2011
@@ -2,10 +2,6 @@
 use warnings;
 
 BEGIN {
-    if ($ENV{'PERL_CORE'}){
-        chdir('t');
-        unshift(@INC, '../lib');
-    }
     use Config;
     if (! $Config{'useithreads'}) {
         print("1..0 # SKIP Perl not compiled with 'useithreads'\n");

Modified: branches/upstream/libthread-queue-perl/current/t/06_insert.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libthread-queue-perl/current/t/06_insert.t?rev=68973&op=diff
==============================================================================
--- branches/upstream/libthread-queue-perl/current/t/06_insert.t (original)
+++ branches/upstream/libthread-queue-perl/current/t/06_insert.t Fri Feb 18 09:10:22 2011
@@ -2,10 +2,6 @@
 use warnings;
 
 BEGIN {
-    if ($ENV{'PERL_CORE'}){
-        chdir('t');
-        unshift(@INC, '../lib');
-    }
     use Config;
     if (! $Config{'useithreads'}) {
         print("1..0 # SKIP Perl not compiled with 'useithreads'\n");

Modified: branches/upstream/libthread-queue-perl/current/t/07_lock.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libthread-queue-perl/current/t/07_lock.t?rev=68973&op=diff
==============================================================================
--- branches/upstream/libthread-queue-perl/current/t/07_lock.t (original)
+++ branches/upstream/libthread-queue-perl/current/t/07_lock.t Fri Feb 18 09:10:22 2011
@@ -2,10 +2,6 @@
 use warnings;
 
 BEGIN {
-    if ($ENV{'PERL_CORE'}){
-        chdir('t');
-        unshift(@INC, '../lib');
-    }
     use Config;
     if (! $Config{'useithreads'}) {
         print("1..0 # SKIP Perl not compiled with 'useithreads'\n");

Modified: branches/upstream/libthread-queue-perl/current/t/08_nothreads.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libthread-queue-perl/current/t/08_nothreads.t?rev=68973&op=diff
==============================================================================
--- branches/upstream/libthread-queue-perl/current/t/08_nothreads.t (original)
+++ branches/upstream/libthread-queue-perl/current/t/08_nothreads.t Fri Feb 18 09:10:22 2011
@@ -1,12 +1,5 @@
 use strict;
 use warnings;
-
-BEGIN {
-    if ($ENV{'PERL_CORE'}){
-        chdir('t');
-        unshift(@INC, '../lib');
-    }
-}
 
 use Test::More 'tests' => 32;
 

Modified: branches/upstream/libthread-queue-perl/current/t/99_pod.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libthread-queue-perl/current/t/99_pod.t?rev=68973&op=diff
==============================================================================
--- branches/upstream/libthread-queue-perl/current/t/99_pod.t (original)
+++ branches/upstream/libthread-queue-perl/current/t/99_pod.t Fri Feb 18 09:10:22 2011
@@ -9,15 +9,17 @@
 }
 
 SKIP: {
-    eval 'use Test::Pod 1.26';
-    skip('Test::Pod 1.26 required for testing POD', 1) if $@;
+    if (! eval 'use Test::Pod 1.26; 1') {
+        skip('Test::Pod 1.26 required for testing POD', 1);
+    }
 
     pod_file_ok('lib/Thread/Queue.pm');
 }
 
 SKIP: {
-    eval 'use Test::Pod::Coverage 1.08';
-    skip('Test::Pod::Coverage 1.08 required for testing POD coverage', 1) if $@;
+    if (! eval 'use Test::Pod::Coverage 1.08; 1') {
+        skip('Test::Pod::Coverage 1.08 required for testing POD coverage', 1);
+    }
 
     pod_coverage_ok('Thread::Queue',
                     {
@@ -31,8 +33,9 @@
 }
 
 SKIP: {
-    eval 'use Test::Spelling';
-    skip("Test::Spelling required for testing POD spelling", 1) if $@;
+    if (! eval 'use Test::Spelling; 1') {
+        skip('Test::Spelling required for testing POD spelling', 1);
+    }
     if (system('aspell help >/dev/null 2>&1')) {
         skip("'aspell' required for testing POD spelling", 1);
     }




More information about the Pkg-perl-cvs-commits mailing list