http://www.perlmonks.org?node_id=888007

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:

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

Replies are listed 'Best First'.
Re: perl threads and perl versions
by BrowserUk (Patriarch) 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.