Installation

Use CPAN or Macports for Perl modules needed under OS X?

Use CPAN or Macports for Perl modules needed under OS X?

by Murray Eisenberg -
Number of replies: 5
For a WeBWorK 2.8 installation under OS X (10.9.1), is there any particular reason to prefer one of CPAN or Macports for installing requisite perl modules?

The version of perl that my Terminal command-line shows is the one installed from Macports. Does that affect the answer?
In reply to Murray Eisenberg

Re: Use CPAN or Macports for Perl modules needed under OS X?

by Bill Farr -
Murray,
You have apparently already used MacPorts to install Perl, so I don't see any reason not to use it to install the modules. On the other hand, you can certainly use CPAN as long as you make sure the cpan command you use is the one installed by MacPorts. Otherwise, modules could be installed in the wrong locations and not be accessible.

When I installed WeBWorK under Snow Leopard and earlier OS X versions, I used MacPorts to install all but one of the modules. The names for the modules were easy to deduce from the FreeBSD names in the table in the WW 2.4 installation manual. A quick search on the MacPorts site is all that is needed to confirm the name. I believe that I once wrote up an html fragment that added a column to this table with the MacPort names for the modules. I could probably find it if you are interested. 

I think the biggest advantages to using MacPorts are the following.

1. MacPorts takes care of dependencies. That is, if you try to install a module, but it depends on modules you don't have installed, MacPorts goes ahead and installs them for you.

2. Keeping your installation up to date is very easy with MacPorts. 

The one module I couldn't find on the MacPorts site I installed using CPAN.
I don't currently have access to a Mac with Mavericks.
In reply to Bill Farr

Re: Use CPAN or Macports for Perl modules needed under OS X?

by John Jones -
If you started with macports, then I would recommend using only macports.  Otherwise you can get incompatible versions of perl modules which cause problems which are very hard to track down.

John

In reply to Bill Farr

Re: Use CPAN or Macports for Perl modules needed under OS X?

by Murray Eisenberg -
I think I've put together the pieces on how to identify the MacPorts Perl modules I need to install to satisfy WeBWorK's requirements:

  1. From the WeBWork installation directory, which is /opt/webwork/webwork2_github, run:

    ./bin/check_modules.pl apache2


  2. After installing clan, run: sudo perl -MCPAN -e shell

  3. Inside that shell, for each module listed from output in step 1, e.g., Date::Format, run corresponding command:

    m Date::Format


  4. From the indicated CPAN_FILE found in step 3, e.g., TimeDate-x.xx.tar.gz, find the corresponding Macports port:

    port search timedate

  5. Install that Macports port, e.g.:

    port install p5-timedate

    (I haven't dealt yet with the complexity of creating ports for any modules not yet having MacPorts ports already.)

In reply to Murray Eisenberg

Re: Use CPAN or Macports for Perl modules needed under OS X?

by John Jones -
This is not the same as using the macport version of the modules.  I think there is a macports "port" of every module you need, but you would need to determine its name and use "sudo port install modulename" where modulename is things like p5-data-uuid, p5-timedate, p5-soap-lite, etc.  I think one can guess the module name from the perl module by using hypens instead of :: and prefixing it with p5 (for perl 5).

John

In reply to John Jones

Re: Use CPAN or Macports for Perl modules needed under OS X?

by Bill Farr -
John is correct, the MacPort names aren't hard to guess, especially if you start from the FreeBSD names in the table in the WeBWorK 2.4 installation manual. I once copied the html for the table and added a column with the MacPort names for the required modules. I've attached the html fragment to this message in case there is any interest. 

The table only includes the modules required for WeBWorK 2.7.

Bill