in reply to How to upgrade local module using -MCPAN?

Yes, it is very simple.

What exactly do you mean by "local"? Do you mean those Perl modules installed in your system for everyone to use (e.g. in /usr/lib/perl), or do you mean those Perl modules installed off your own personal home directory? CPAN can be used for upgrading either, but the details vary slightly between these two cases.

the lowliest monk

  • Comment on Re: How to upgrade local module using -MCPAN?

Replies are listed 'Best First'.
Re^2: How to upgrade local module using -MCPAN?
by Anonymous Monk on May 26, 2005 at 01:27 UTC
    Sorry Sir, I meant the first one (for all to use in /usr/lib/perl).

      Update: chromatic confirmed my suspicion that CPAN is a core module. I won't bore you with a descrition of the tortuous path that led me to doubt this and then write the blather below about installing CPAN.pm from scratch; it'll suffice to say that it is besides the point.


      Well, in that case what you want to do is pretty much what -MCPAN will do right out of the box, at least for Unix-like systems (which the only kind I have experience with; keep this in mind as you read what follows).

      Of course, first you need to install CPAN.pm itself, and to be honest, this is one of those things, like making sourdough bread, where one seeds the process once and then each subsequent iteration is based on the results of the previous one. Similarly, once one installs CPAN.pm the first time, it takes care of all subsequent installations of new versions of itself. This is a long way of saying that it has been a very long time since I had to install CPAN.pm on a system that didn't already have some version of CPAN.pm installed. I guess that you will have to download the CPAN.pm distribution file and follow the standard

      perl Makefile.PL make make test make install
      sequence from within the directory where you unpacked the CPAN.pm distribution.

      On my system (a Debian Linux box), the main configuration file for CPAN.pm lives in /etc/perl/CPAN/Config.pm. There are a whole bunch of options that can be specified in this file. I will have to refer you to the docs for the details: CPAN.

      Once you have CPAN.pm installed and properly configured, then just run

      % perl -MCPAN -e shell
      or simply invoke the cpan script (which should have been installed in your PATH). Just make sure that you have sufficient privileges to write to the global directories. In fact the lines above may need to be something like
      % sudo perl -MCPAN -e shell
      or simply
      % sudo cpan
      Once inside the CPAN shell, just use the install to install whatever you want:

      % perl -MCPAN -e shell

      cpan shell -- CPAN exploration and modules installation (v1.7601)
      ReadLine support enabled

      cpan> install Sex

      If you have configured CPAN.pm properly, the above command will fetch, unpack, build, test, and install schwern's Sex.pm, for example.

      the lowliest monk

        I'm sorry Sir. But I know that already. My problem is how can I 'upgrade' the module. Say Sex.pm version 1.0 to Sex.pm version 2.0.