Threadbare

Ovid on 2005-08-24T18:56:48

Someone sent me an email asking how to tell if your Perl is compiled with threads. I replied:

ovid $ perl -V|grep -i thread
    usethreads=undef use5005threads=undef useithreads=undef

That's when I noticed I forgot to enable thread support the last time I recompiled Perl. Crap.


another faster way sans grep

merlyn on 2005-08-24T22:15:51

It suffices to say
perl -V:usethreads
which pulls just that value from the config, and in a way that you can use it with an sh eval:
eval `perl -V:usethreads`;
case $usethreads in define) ... ;; undef) ... ;; esac

Re:another faster way sans grep

Ovid on 2005-08-25T07:06:45

Sweet! A new tip. Thanks.

Re:another faster way sans grep

rafael on 2005-08-25T07:29:55

And regexps work !

perl -V:use.*threads

better off without them

perrin on 2005-08-25T14:41:33

Don't compile with thread support unless you need it. It slows down your Perl by about 15%, even if you never use threads.

Re:better off without them

Ovid on 2005-08-25T15:26:29

I need it for some of my side projects. Specifically, Language::Prolog::Yaswi requires a threaded Perl if my SWI-Prolog is threaded (which it is).