Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

perl threads and perl versions

by markseger (Beadle)
on Feb 14, 2011 at 15:15 UTC ( #888007=perlquestion: print w/ replies, xml ) Need Help??
markseger has asked for the wisdom of the Perl Monks concerning the following question:

I have a script that uses threads and threads::shared. It works fine on fedora14 and some other distros, though I forget the different ones it worked correctly on.

In any event, I'm now on a centos 5.3 box with perl V5.8.8 and when I execute the following to join the threads befor exiting:

foreach my $thread (threads->list(threads::joinable)) { $thread->join(); }
I get an error:

Usage: threads::list(classname) at ./colmux.pl line 295.

I've observered a couple of things:

  • on the centos system if I just comment out this look my program exists cleanly and so it doesn't even look like I need it!
  • on the fedora system if I comment out that look I get the following:
    Perl exited with active threads: 0 running and unjoined 6 finished and unjoined 0 running and detached which was why I included it in the first place.

so my question is, is this a version thing? Should I just skip that loop if perl is less than a particular version number and if so what? or is there some simply test I can run to see if this is supported by my persion of perl, which might be the cleanest.

-mark

Comment on perl threads and perl versions
Download Code
Re: perl threads and perl versions
by BrowserUk (Pope) on Feb 14, 2011 at 15:23 UTC

    What do you get if you do perl -Mthreads -le'print $threads::VERSION' ?


    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.
      aha! the system with the problem is running threads 1.07 and the one that works is 1.81! So should I just assume the problem IS with the threads version? Of course the challenge is which version fixed the problem. any clues on that one? -mark
        Of course the challenge is which version fixed the problem. any clues on that one?

        The "problem" is that you are trying to use functions that were not a part of the module at that time.

        Any version after 1.59 will not give the error you posted. But I strongly advise going for the latest version available when you upgrade.


        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
Node Status?
node history
Node Type: perlquestion [id://888007]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (14)
As of 2014-11-26 20:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (172 votes), past polls