Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Bareword "threads::joinable" not allowed while "strict subs" in use

by lifang11 (Novice)
on Dec 26, 2013 at 08:27 UTC ( [id://1068400]=perlquestion: print w/replies, xml ) Need Help??

lifang11 has asked for the wisdom of the Perl Monks concerning the following question:

Bareword "threads::joinable" not allowed while "strict subs" in use

The program is:
#!/usr/bin/perl use warnings; use strict; use threads; my $thread_num = 2; foreach(1..10){ if(threads->list()>=$thread_num){ sleep(1); foreach my $thr (threads->list(threads::joinable)){ $thr->join(); } } threads->create(\&runthread,$_); } while(threads->list()){ sleep(10); foreach my $thr (threads->list(threads::joinable)){ $thr->join(); } } exit(0); sub runthread { print($_[0],"\n"); print(threads->list(),"\n"); return 0; }

The "perl -V" is:

Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=MSWin32, osvers=5.1, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef usethreads=define use5005threads=undef useithreads=define usemulti +plicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags =' -s -O2 -DWIN32 -DHAVE_DES_FCRYPT -DPERL_IMPL +ICIT_CONTEXT -DPERL_IMPLICIT_SYS -fno-strict-aliasing -DPERL_MSVCRT_R +EADFIX', optimize='-s -O2', cppflags='-DWIN32' ccversion='', gccversion='3.4.5', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='long lo +ng', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='g++', ldflags ='-s -L"C:\strawberry\perl\lib\CORE" -L"C:\straw +berry\c\lib"' libpth=C:\strawberry\c\lib libs= -lmsvcrt -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool - +lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid - +lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 perllibs= -lmsvcrt -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspo +ol -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luu +id -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 libc=-lmsvcrt, so=dll, useshrplib=yes, libperl=libperl58.a gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-mdll -s -L"C:\strawberry\perl\lib\CORE +" -L"C:\strawberry\c\lib"' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS PERL_MALLOC_WRAP PL_OP_SLAB_ALLOC USE_ITHREADS USE_LARGE_FILES USE_PERLIO Built under MSWin32 Compiled at Oct 19 2008 16:39:57 @INC: C:/strawberry/perl/lib C:/strawberry/perl/site/lib .

Replies are listed 'Best First'.
Re: Bareword "threads::joinable" not allowed while "strict subs" in use
by BrowserUk (Patriarch) on Dec 26, 2013 at 08:45 UTC

    Best guess: the version of threads that came with 5.8.8 predates the addition of the threads::joinable constant.

    Solution: Upgrade.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      I seem to recall the threads module can be updated on it's own, if upgrading the perl instance isn't an option.

        Indeed it can. But I've no idea if the latest threads would work with such an old perl.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1068400]
Approved by BrowserUk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-03-29 07:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found