Subject: | Net::Daemon fails if 'use threads::shared' precedes use Net::Daemon |
Net::Daemon seems to fail if threads::shared has been loaded prior to
the "use Net::Daemon;" call. The attached file is your
Net::Daemon/t/base.t test case plus:
use threads;
use threads::shared;
Here's what happens on my system:
----------
perl NetDaemon-base.pl
1..1
Type of arg 1 to threads::shared::share must be one of [$@%] (not single
ref constructor) at /usr/lib/perl5/vendor_perl/5.16.0/Net/Daemon.pm line
54, near "$Net::Daemon::RegExpLock) "
BEGIN not safe after errors--compilation aborted at
/usr/lib/perl5/vendor_perl/5.16.0/Net/Daemon.pm line 56.
Compilation failed in require at NetDaemon-base.pl line 9.
BEGIN failed--compilation aborted at NetDaemon-base.pl line 9.
not ok 1
% uname -a
Linux sr1650nx 3.4.11-2.16-desktop #1 SMP PREEMPT Wed Sep 26 17:05:00
UTC 2012 (259fc87) x86_64 x86_64 x86_64 GNU/Linux
%pmvers Net::Daemon threads threads::shared
Net::Daemon: 0.48
threads: 1.86
threads::shared: 1.4
% perl -v
This is perl 5, version 16, subversion 0 (v5.16.0) built for
x86_64-linux-thread-multi
----------
To get both original and modified base.t and my own application working
in my particular Perl environment, I made the following edits to Daemon.pm:
41,44c41,42
< if ($this_is_510) {
< eval { require threads; };
< eval { require threads::shared; };
< }
---
Show quoted text
> use threads;
> use threads::shared;
54c52
< threads::shared::share(\$Net::Daemon::RegExpLock) if $this_is_510;
---
Show quoted text> threads::shared::share($Net::Daemon::RegExpLock) if $this_is_510;
The threads::shared::share() call now matches its documentation, so that
change seems right, but I don't understand the subtleties of the
"this_is_510" test and its dummy share.
Thanks for looking at this.
Subject: | NetDaemon-base.pl |
# $Id: base.t,v 1.2 1999/08/12 14:28:59 joe Exp $
#
use threads;
#use threads::shared;
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use Net::Daemon;
$loaded = 1;
print "ok 1\n";