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

Hi Monks,

I'm currently writing a program that related to thread, but my
perl told me that I need 5.8.6 to make it works, so can any monks
clarify this to me, why perl do not have predefined thread as in
python. and which module I can use to communicate in threads.

Thanks,

whatluo

Replies are listed 'Best First'.
Re: perl 5.8.4 threads
by BrowserUk (Patriarch) on Jun 01, 2005 at 07:27 UTC

    Be aware that Perl's ithreads are quite different from Python's threads, and much, harder to use well.

    Python's threads are "user threads" whereas Perl's are "kernel threads". Google for many good descriptions of the difference and the pros and cons of both.

    ... my perl told me that I need 5.8.6 ...

    Tell "your perl" it's wrong. Perl has had threads since 5.6.1 and usable threads since 5.8.4, though it is correct that if you are going to use threads, it would be a good idea to get the latest version.

    why perl do not have predefined thread as in python.

    You have to do from threading import Thread to use threads in Python and use threads; to use threads in Perl. What difference?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.
Re: perl 5.8.4 threads
by PodMaster (Abbot) on Jun 01, 2005 at 07:12 UTC
    but my perl told me that I need 5.8.6 to make it works
    Are you sure? What was the exact error message?
    why perl do not have predefined thread as in python
    Hmm, I'm guessing you mean your perl wasn't built with threads (perl -V:useithreads returns useithreads='undef';)? I think python can also be built without thread support. Just compile another one.

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

Re: perl 5.8.4 threads
by tchatzi (Acolyte) on Jun 01, 2005 at 09:04 UTC
    Enter on your command prompt/shell
    # perl -V
    The V is capital.
    The results will be how your perl was compiled
    If you see something like this
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicit +y=undef
    Then you have to recompile your perl with threads enable.

    ``The wise man doesn't give the right answers, he poses the right questions.'' TIMTOWTDI
      Yes ,
      usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
      my perl is not compiled with thread, so I need re-compile it to make it usable,

      thanks everyone,

      whatluo

Re: perl 5.8.4 threads
by salva (Canon) on Jun 01, 2005 at 08:38 UTC
    perl told me that I need 5.8.6 to make it works

    It's very unlinkely that this error is related to threads. Are you sure the problem is not in another module? possible a recent one from CPAN?

    Try greping your installed perl packages for "5.008006" or "5.8.6" to see which one has that requirement.

Re: perl 5.8.4 threads
by thcsoft (Monk) on Jun 01, 2005 at 08:47 UTC
    i'm using perl 5.8.4 myself and have no technical problems with using threads. maybe your perl hasn't been compiled with threads?

    language is a virus from outer space.