0

I'm facing some issues for quite some days now, google hasnt helped me too much. I want to use perl program that requires threads but it gives me a hard time. i'm currently using Perl 5.10.1, it doesnt support multi threading but normally the commands i've pasted below should install without any problems. I'm willing to be rewarding for the good helper.

So I've tried this:

sudo su -
cpan
install shared::thread

(Highly mangled) output:

root@noc:~# sudo su - root@noc:~# cpan Terminal does not support
AddHistory.

cpan shell -- CPAN exploration and modules installation (v1.9402)
Enter 'h' for help.

cpan[1]> install shared::thread CPAN: Storable loaded ok (v2.20) Going
to read '/root/.cpan/Metadata' Database was generated on Wed, 12 Dec
2012 01:07:04 GMT CPAN: Time::HiRes loaded ok (v1.9719) Warning: no
success downloading
'/root/.cpan/sources/authors/01mailrc.txt.gz.tmp22514'. Giving up on
it. at /usr/lib/perl5/5.10.1/CPAN/Index.pm line 225 LWP not available

Trying with "/usr/bin/curl -L -f -s -S --netrc-optional" to get
"http://www.perl.org/CPAN/authors/01mailrc.txt.gz" CPAN:
Compress::Zlib loaded ok (v2.02) CPAN: YAML loaded ok (v0.84) Going to
read '/root/.cpan/sources/authors/01mailrc.txt.gz'
..................................................
..........................DONE Warning: no success downloading
'/root/.cpan/sources/modules/02packages.details.txt.gz.tmp22514'.
Giving up on it. at /usr/lib/perl5/5.10.1/CPAN/Index.pm line 225

Trying with "/usr/bin/curl -L -f -s -S --netrc-optional" to get
"http://www.perl.org/CPAN/modules/02packages.details.txt.gz" Going to
read '/root/.cpan/sources/modules/02packages.details.txt.gz' Database
was generated on Fri, 14 Dec 2012 01:07:03 GMT HTTP:ate not available
.............. New CPAN.pm version (v1.9800) available. [Currently
running version is v1.9402] You might want to try install CPAN reload
cpan to both upgrade CPAN.pm and run the new version without leaving
the current session.


.................................................. ............DONE
Warning: no success downloading
'/root/.cpan/sources/modules/03modlist.data.gz.tmp22514'. Giving up on
it. at /usr/lib/perl5/5.10.1/CPAN/Index.pm line 225

Trying with "/usr/bin/curl -L -f -s -S --netrc-optional" to get
"http://www.perl.org/CPAN/modules/03modlist.data.gz" Going to read
'/root/.cpan/sources/modules/03modlist.data.gz'
..................................................
..........................DONE Going to write /root/.cpan/Metadata
Warning: Cannot install shared::thread, don't know what it is. Try the
command

i /shared::thread/

to find objects with matching identifiers.

cpan[2]>
ikegami
  • 367,544
  • 15
  • 269
  • 518

2 Answers2

3

If you want Thread::Shared, You need to remember cpan is case-sensitive, Use sudo cpan install Thread::Shared. You dont need to do su after sudo

Karthik T
  • 31,456
  • 5
  • 68
  • 87
1

I'm currently using Perl 5.10.1, it doesnt support multi threading

First, let's make sure. If you have a Perl that supports threading, you'd get this output:

$ perl -V:usethreads
usethreads='define';

If that's what you got, you're merely misspelling "threads::shared", which you don't even need to install becomes it comes with Perl already.

If that's not what you get, your Perl doesn't support threads, and you'll need to create a build of Perl that does (i.e. build a Perl configured using -Dusethreads). You can't just install a module to add threading support since threading supports requires extra code throughout Perl's internals.


To make your own build of Perl, I recommend perlbrew, which is installed as follows:

curl -kL http://install.perlbrew.pl | bash

(You'll be instructed to add something to your login script, and you should log back in to make sure everything is setup right.)

This makes it easy to install a new Perl:

perlbrew install -v 5.16.2 --as=5.16.2t -Dusethreads
ikegami
  • 367,544
  • 15
  • 269
  • 518