Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Building module by hand

by techgirl (Beadle)
on Nov 03, 2004 at 15:13 UTC ( #404917=perlquestion: print w/replies, xml ) Need Help??

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

To build a module by hand on a Unix machine,* is this correct?

I put the unpacked source into

/home/user/.cpan/build

Navigate to that directory and type

perl Makefile.PL make make test make install

And this creates the proper (everything)?

And -- when removing modules on a Unix machine, I just remove the same directory that was created in
/home/user/.cpan/build -- is that correct? What about one other thing -- is there a central file or database that keeps track of all installed modules? Do I have to remove an entry from that?

One node here says that using CPAN and 'clean' will remove a module as well. Can someone verify that...

*The reason that I'm building by scratch is because I do not want the latest version of certain modules; I want older versions.

Replies are listed 'Best First'.
Re: Building module by hand
by davorg (Chancellor) on Nov 03, 2004 at 15:29 UTC
    To build a module by hand on a Unix machine,* is this correct?
    I put the unpacked source into /home/user/.cpan/build

    That doesn't matter. You can build and install it from any directory.

    Navigate to that directory and type
    perl Makefile.PL
    make
    make test
    make install

    You probably need to be root for this step.

    And this creates the proper (everything)?

    Yes

    And -- when removing modules on a Unix machine, I just remove the same directory that was created in /home/user/.cpan/build -- is that correct?

    No. The "make install" installs the module into your library path (probably under /usr/lib/perl5/5.8.x/site_perl). You'll need to manually remove the files from there.

    What about one other thing -- is there a central file or database that keeps track of all installed modules? Do I have to remove an entry from that?

    Try "perldoc perllocal" for this list.

    One node here says that using CPAN and 'clean' will remove a module as well. Can someone verify that...

    That's nonsense. That will just clean up the directory that you ran the installation from.

    --
    <http://www.dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

      davorg said:
      Navigate to that directory and type

      perl Makefile.PL

      make

      make test

      make install You probably need to be root for this step.

      My epxerience has been that the make and make test can be done as any user, bu thte make install probably needs to be root.

      jdtoronto

Re: Building module by hand
by gellyfish (Monsignor) on Nov 03, 2004 at 15:26 UTC

    Except that it is not important where you unpack the the source yes that is the correct way to install a module.

    The locally installed modules are added to a file called perllocal.pod you can see the installed module by doing perldoc perllocal

    As to uninstalling a module you will have to track down the installed files in @INC and delete then.

    /J\

Re: Building module by hand
by kutsu (Priest) on Nov 03, 2004 at 15:34 UTC

    It doesn't matter where you put the module, but yes those procedures are correct. However, you can specify the version you want using the CPAN module (perl -MCPAN -e 'shell') through the install command. From man CPAN:

    ...if you would like to install version 1.23_90, you need to know wher +e the distribution file resides on CPAN relative to the authors/id/ d +irectory. If the author is BAR, this might be BAR/Foo-1.23_90.tar.gz; + so you would have to say install BAR/Foo-1.23_90.tar.gz The first example will be driven by an object of the class CPAN +::Module, the second by an object of class CPAN::Distribution.

    "Cogito cogito ergo cogito sum - I think that I think, therefore I think that I am." Ambrose Bierce

Re: Building module by hand
by Fletch (Chancellor) on Nov 03, 2004 at 15:24 UTC

    perldoc perlmodinstall

Re: Building module by hand
by leriksen (Curate) on Nov 04, 2004 at 04:58 UTC
    I usually do

    prompt> perl Makefile.PL && make test //review output and check for 100% pass prompt> su //login as root rootprompt>make install && exit prompt>

    well-behaved modules need little more than this

    Note the 'CPAN' shell 'clean' does exactly the same as 'make clean', which is delete local temp files (Makefile gets renamed). No 'uninstall'ing gets done. Uninstall support in Perl modules is patchy at best.

    use brain;

Re: Building module by hand
by astaines (Curate) on Nov 03, 2004 at 19:43 UTC

    Hi,


    1. Your description of the build process is correct.
    2. Your idea for removing the module won't work. I don't have a Unix machine to hand just now, but perl installs modules somewhere specific on each architecture. The install directory is not the build directory, so just removing the build directory won't work.
    3. On Windows modules live in "\perl\lib" and "\perl\site\lib" mostly.

      -- Anthony Staines

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2020-08-07 12:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which rocket would you take to Mars?










    Results (44 votes). Check out past polls.

    Notices?