Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

More CPAN woe

by Basilides (Friar)
on Jan 21, 2003 at 16:21 UTC ( [id://228732]=perlquestion: print w/replies, xml ) Need Help??

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

Oh dear, I know this is the silliest question, even more basic than yesterday's, but I'm finding that getting started on CPAN assumes a degree of intelligence and general computer competence which is sadly beyond me. Help me out this time and I promise I'll stop pestering you about it...

Basically, what happens when i install something using the CPAN module? It runs nmake but what does that do? The files unzip to C:/.cpan/build/Spreadsheet-ParseExcel-0.2602, for example (incidentally, as you can see I'm a Windows user). When I want to use the module however,

use strict; use Spreadsheet::ParseExcel;
can't find it. So I could do
use strict; use lib "C:/.cpan/build"; use Spreadsheet-ParseExcel-0.2602::ParseExcel;
but that can't be right surely. So I could set up a new folder in C:/perl/lib/ called Spreadsheet, and copy everything in there? Is that what people do? With every single module they download?

If anyone could, in the simplest possible terms, talk me through installing, and then useing a module, using the CPAN command line (I know there's PPM, but I've started with this one, so I'd like to see it through) I'd be so grateful. If you could tell me what the stages make, test, install actually do, that'd be interesting too.

Cheers
Dennis

Replies are listed 'Best First'.
Re: More CPAN woe
by hardburn (Abbot) on Jan 21, 2003 at 17:19 UTC

    The standard means of installing a Perl module manualy are like this:

    Makefile.PL
    make
    make test
    make install

    Makefile.PL is a perl script that generates a "Makefile". Makefiles are from the unix world, and they provide a means of automatically compiling a program or library. The "make" (or "nmake" in your case) does the actual compile. In a Perl module that uses C in the background, that means compiling the C code into object code. In a Perl module that only contains Perl code, the 'make' portion might do nothing at all.

    "make test" reads the Makefile and does a bunch of tests on the compiled code. Finally, "make install" copies all the files into a place where they can be useful. After that runs, you should be able to just "use Some::Module;" in your code.

    When CPAN is used to install the module, the "make" stage runs "Makefile.PL" and "make". The "test" stage automatically does the "make" stage, and then runs "make test". The "install" stage automatically does the "test" stage, then runs the "make install".

    So I'm guessing your getting problems in the "make install" portion. It might be copying things to a bad location, not copying at all, or not even running.

Re: More CPAN woe
by foxops (Monk) on Jan 21, 2003 at 17:12 UTC
Re: More CPAN woe
by glwtta (Hermit) on Jan 21, 2003 at 17:23 UTC
    I am not too familiar with using this on windows, but it should be fairly equivalent to the UNIX process.

    make runs the Makefile through make, all actual compilation and such (for pure perl modules this is usually just formatting documentation) happens here
    make test runs the tests included with the module distribution, if they fail the installation shouldn't proceed.
    make install actually copies the new module to where your scripts can find it, without having to do a 'use lib'

    the CPAN command line is the easiest way to go here. simply run it with 'bash$ perl -MCPAN -e shell;' and type 'install Spreadsheet::ParseExcel' this will download the module, make it, test it and install it in the proper location; it will also take care of any dependencies for you (which can save A LOT of headaches)
    Of course the catch 22 here is that you need to install the CPAN module first.

    Again, I don't have any experience with this on windows, but that's the general idea.

Re: More CPAN woe
by logan (Curate) on Jan 21, 2003 at 19:40 UTC
    I know exactly what you're going through. I've had monsterous difficulty installing CPAN modules under Windows. Let's face it, Perl was designed to run on unix, and while it can be used on a Windows box, it's still primarily a unix beast. That said, I think I've found an answer for you. Try this node. Hope it helps.

    -Logan
    "What do I want? I'm an American. I want more."

Re: More CPAN woe
by phydeauxarff (Priest) on Jan 21, 2003 at 17:41 UTC
    With PPM all you need to do is install the module
    Start PPM
    then issue;
    install Spreadsheet::ParseExcel Bees
      errr...
      make that;
      install Spreadsheet::ParseExcel

      Bees

Re: More CPAN woe
by Brutha (Friar) on Jan 22, 2003 at 12:20 UTC
    C:/perl/site/lib is the destination to hold additions to the default (what's installed on your site), C:/perl/lib contains the Perl core moduls, I keep this directory untouched. This is a mostly unknown Unix habit to keep user-additions apart (just look into the windows directories, to see what I mean).

    I always download the Source-Package.tgz, unzip it with winzip, change to the directory and make everything (well, nmake) as told in other responses. I installed even TK, DBI, DBD::DB2 etc with this method (I have a C compiler installed). After nmake install, I find the modules in the site/lib path and use them as wanted. BTW I read something about a tool to update the HTML help from the new PODs

    And it came to pass that in time the Great God Om spake unto Brutha, the Chosen One: "Psst!"
    (Terry Pratchett, Small Gods)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-19 19:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found