How to install Perl modules
Ryan Schmidt
ryandesign at macports.org
Mon Sep 14 03:41:14 PDT 2009
On Sep 14, 2009, at 05:17, Mine wrote:
> I am trying to run a Perl app called get_iplayer (http://linuxcentre.net/getiplayer/
> ) on OSX 10.4.11.
> I have been told the the following modules are required:
>
> Built-ins:
>
> use Fcntl
> use File::Copy
> use File::Path
> use File::stat
> use Getopt::Long
> use IO::File
> use IO::Handle
> use IO::Seekable
> use IO::Socket
> use POSIX
> use POSIX
> use Socket
> use Time::Local
>
> Ones that aren't in core AFAIK:
>
> use CGI
> use CGI::Cookie
> use HTML::Entities
> use HTTP::Cookies
> use HTTP::Headers
> use IPC::Open3
> use LWP::ConnCache
> use LWP::UserAgent
> use URI
> use URI::Escape
>
> I think the first set are part of the standard Perl 5 install, but
> the second group are options
> which can be added as required.
>
> Can someone please tell me if it is possible to install these
> modules using MacPorts.
> I have searched the available Ports and found p5-cgi, and have found
> a few html
> files, but I am not sure which of these files contain the modules I
> need, or how to find
> the others.
There isn't a way in MacPorts to know what a port installs until after
you've installed it, so that's not helpful for figuring out what port
you need to install. For Perl modules, I would suggest searching the
CPAN web site for the module in question, and it should tell you what
package you need to install to get it. To convert a CPAN package name
to a MacPorts port name, convert uppercase to lowercase letters,
replace "::" with "-" and prepend "p5-".
According to "port contents p5-cgi" (after running "sudo port install
p5-cgi") it installs both CGI and CGI::Cookie (and others).
According to a search on cpan.org, HTML::Entities is in the
HTML::Parser package, which is the p5-html-parser port.
http://search.cpan.org/search?query=HTML%3A%3AEntities&mode=all
HTTP::Cookies, HTTP::Headers, LWP::ConnCache and LWP::UserAgent are
all in p5-libwww-perl.
http://search.cpan.org/search?query=HTTP%3A%3ACookies&mode=all
URI and URI::Escape are in p5-uri.
http://search.cpan.org/search?query=URI%3A%3AEscape&mode=all
> I have found the files on CPAN but I am not sure how to do a manual
> install into the
> opt/ location required by MacPorts.
Please don't use CPAN to manually install files into MacPorts-owned
directories; this will confuse MacPorts and prevent it from being able
to manage your dependencies properly. Instead, use MacPorts to install
these modules. If the modules you need don't exist, file requests for
them, or better yet, make the ports and submit them. The cpan2port
script makes it very easy to make ports for CPAN modules.
More information about the macports-users
mailing list