Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Can't install CPAN modules

by hsfrey (Beadle)
on Oct 12, 2011 at 23:45 UTC ( [id://931109]=perlquestion: print w/replies, xml ) Need Help??

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

Is there a simple document somewhere that explains how to download and install modules from CPAN onto Windows systems?

Every method I try fails.

The perlmodinstall doc had me download nmake.exe, which blows up with a syntax error when I try to use it ("missing a bracket", it says.)

I have the pm I want on the computer, but, wherever I put it (in @INC) my programs can't find it.

Is there any reason the process just to download a subroutine has to be so baroque? Elsewhere, entire massive programs are downloaded with a single click. The particular module I'm looking for is MATH::Random.

Replies are listed 'Best First'.
Re: Can't install CPAN modules
by keszler (Priest) on Oct 12, 2011 at 23:53 UTC

    Math::Random is a Perl wrapper around compiled C code. Since you did not have make I assume you don't have a C compiler; that's why it fails.

    If you're using Activestate Perl, ppm install Math::Random at the DOS command line should be all you need to do.

      Thank you. When I enter that command, the reply is "No missing packages to install", which would lead one to believe that the module is installed properly.

      But, when I put code like:

      use MATH::Random; $a = random_uniform(45); print "\na=$a";
      I get an error message:
      Can't locate loadable object for module Math::Random in @INC

      In perl/lib/Math I have a file named Random.pl
      I have other pieces of the download scattered all around the disc, since I had no idea what was supposed to go where.

      If ppm could find the module, why couldn't perl?

        I suspect that your earlier efforts to install put the Perl wrapper files in place - enough to confuse ppm - but not the compiled files. (In my site/lib/auto/Math/Random directory are Random.bs, Random.dll, Random.exp, and Random.lib.)

        Try ppm install --force Math::Random - the force option will make ppm replace whatever is currently in place.

        I agree with keszler that previous attempts have your Perl installation a bit confused.

        In the future, I recommend using the graphical version of ppm (Active State's Perl package manager). typing simplly "ppm" at the command prompt without parameters will start the GUI version. "ppm help" gives help for the command line version, but for most simple things the GUI is easier to use.

        If you have really messed things up, un-install Perl (via the normal add/remove program way) and re-install Active State's Perl, then use ppm for all future package installations. This will save many hours of frustration on your end!

Re: Can't install CPAN modules
by cjb (Friar) on Oct 13, 2011 at 11:25 UTC

    If you want to use CPAN rather than PPM, it might be worth having a look at Strawberry Perl as that comes with a C compiler and all the other requirements for CPAN

      Actually so does Active State's Perl package as of about 5.10.

      It's hard to imagine how the OP got a modern install of Perl (assuming it to be such) on to their system without getting a compiler and support for using cpan.

      True laziness is hard work
Re: Can't install CPAN modules
by marscld (Beadle) on Oct 13, 2011 at 08:11 UTC
    Have u confirmed that the ppm is able to connect to the internet Perl library ? After that, the module and its dependencies can be installed seamlessly.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://931109]
Approved by keszler
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2024-03-28 21:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found