installing Perl Modules - Mac OS X

Hi,

What i did to install couple of modules to my Perl. What i wanted was File::Listing IO:Handle File::Find and Net::FTP.

First, i ran:

alak$ sudo perl -MCPAN -e shell

and it prompts for some auto configuration stuff, i choose [Yes].

Would you like me to configure as much as possible automatically? [yes]

Ok, a hell lot of text on screen, and at the bottom end:

...............
New CPAN.pm version (v1.9402) available.
  [Currently running version is v1.9301]
You might want to try
install CPAN
reload cpan
to both upgrade CPAN.pm and run the new version without leaving
the current session.
...............


Ouh! Update, ok.. i'll update first:

cpan[2]> install CPAN
Running install for module 'CPAN'
CPAN: Data::Dumper loaded ok (v2.121_17)
...
.... [truncated]
...
CPAN: File::Temp loaded ok (v0.20)

CPAN.pm: Going to build A/AN/ANDK/CPAN-1.9402.tar.gz

Checking if your kit is complete...
Looks good
Warning: prerequisite File::HomeDir 0.69 not found.
Writing Makefile for CPAN
Could not read '/Users/alak/.cpan/build/CPAN-1.9402-vJYlRc/META.yml'. Falling back to other methods to determine prerequisites
---- Unsatisfied dependencies detected during ----
---- ANDK/CPAN-1.9402.tar.gz
         ----
File::HomeDir [requires]
Shall I follow them and prepend them to the queue

of modules we are processing right now? [yes]
...
.... [truncated]
...
perllocal.pod

ANDK/CPAN-1.9402.tar.gz
/usr/bin/make install -- OK
Warning (usually harmless): 'YAML' not installed, will not store persistent state



Syet! a warning. its an eyesore! >.< So i installed it anyway:

cpan[2]> install YAML
Running install for module 'YAML'
'YAML' not installed, falling back to Data::Dumper and Storable to read prefs '/Users/alak/.cpan/prefs'
Running make for A/AD/ADAMK/YAML-0.71.tar.gz
LWP not available
...
.... [truncated]
...
Appending installation info to /opt/local/lib/perl5/5.8.9/darwin-2level/perllocal.pod
ADAMK/YAML-0.71.tar.gz
/usr/bin/make install -- OK
CPAN: YAML loaded ok (v0.71)


Ok. Now back to what i wanted; File::Sharing and Net::FTP. Well, googling, you would find that Net::FTP is part of the libnet-perl package. and File::Listing is part of the libwww-perl package.

Er.. how do i install that eh? Dunno.. heres what i did:

cpan[12]> install Bundle::LWP
MIME::Base64 is up to date (3.09).
Digest::MD5 is up to date (2.39).
URI is up to date (1.54).
Net::FTP is up to date (2.77).
HTML::Tagset is up to date (3.20).
HTML::Parser is up to date (3.65).
HTML::HeadParser is up to date (3.62).
LWP is up to date (5.836).



Note : You might need to exec force install LPW::Bundle instead of just install.

Lets check whether the Modules i ant is there:

alak$ sudo perl -MFile::Find -e 1
alak$ sudo perl -MFile::Listing -e 1
alak$ sudo perl -MIO::Handle -e 1
alak$ sudo perl -MNet::FTP -e 1


No error? Gud! means its already there, so what if it still not there? Well heres an example:

alak$ sudo perl -MIO::ayam -e 1
Can't locate IO/ayam.pm in @INC (@INC contains: /opt/local/lib/perl5/site_perl/5.8.9/darwin-2level /opt/local/lib/perl5/site_perl/5.8.9 /opt/local/lib/perl5/site_perl /opt/local/lib/perl5/vendor_perl/5.8.9/darwin-2level /opt/local/lib/perl5/vendor_perl/5.8.9 /opt/local/lib/perl5/vendor_perl /opt/local/lib/perl5/5.8.9/darwin-2level /opt/local/lib/perl5/5.8.9 .).
BEGIN failed--compilation aborted.


Ok.. Hope this help someone, and be my ref.

//alak

Comments

  1. Thanks a bunch! This helped a lot. I am new to PERL and I can't thank you enough.

    ReplyDelete

Post a Comment

Popular posts from this blog

SAP: Segregate Different SMTP Mail Server Based on Sender Domain

SAP Client Copy Error: Errors occurred during export of container object FINB-TR-DERIVATION