Sunday, 16 May 2004
With most Fedora and/or Redhat installs, Perl comes by default installed too, and is unmissable for a lot of websites..
With that comes the need for extra modules like Net:SSLeay, CGI, libnet, etc, etc.. Perl comes with a very handy shell built in to install these modules.., what you need is root access to a shell and a working connection to the internet..
Issue the command: perl -e shell -MCPAN When running this for the first time you'll get a bunch of configuration questions, you can hit enter at most, just make sure to select a mirror somewhere nearby when it asks for the country and mirrors to use.. (next time you won't get all these questions, and it'll drop to the shell immediatly)
cpan shell -- CPAN exploration and modules installation (v1.7601) ReadLine support available (try 'install Bundle::CPAN')
cpan>
There it is, your handy CPAN shell to easily install extra modules.. You can find a full list of modules on: http://www.cpan.org/
Right, some of the regularly asked modules that aren't always installed by default.., CGI.pm is a nice example.., this is a module that's used by perl scripts with a fill out form on a webpage, and to parse their contents..
Let's install or update it: cpan> install CGI
Now a lot of stuff is going to happen, CPAN will look if CGI is a valid module to install, and if so, it'll download, compile and install it..
It'll end with something along the lines of:
Writing /usr/lib/perl5/5.8.1/i386-linux-thread-multi/auto/CGI/.packlist Appending installation info to /usr/lib/perl5/5.8.1/i386-linux-thread-multi/perllocal.pod /usr/bin/make install -- OK
cpan>
Damn that was easy....
Another nice example: Net::SSLeay Webmin (www.webmin.com) for example, uses this module to be able to be ran over https (if Net:SSLeay isn't installed and you'll try to enable SSL mode, it'll pop up some errors regarding this module)
cpan> install Net::SSLeay
During this install and compile, Net::SSLeay will do some tests to secure sites to see if it's working..
*** WARNING: There were 2 errors in the tests. make: *** [test_dynamic] Error 255 /usr/bin/make test -- NOT OK Running make install make test had returned bad status, won't install without force
cpan>
Uh oh.., it failed.. Now if I scroll back, I can see these are minor failures, so I can decide to install the module anyways.., this can be done from the CPAN shell.., I always tend to do it through a normal bash shell, so I exit the CPAN shell with ctrl+d, this way we'll get a nice insight where CPAN saves the packages too..
cd /root/.cpan/build
Do an ls here, you'll see the packages you installed and tried to install, CGI is there, and Net_SSLeay too..
cd Net_SSLeay.pm-1.25 In this directory are the sources for the module, we'll have to create the Makefile first though (don't confuse it with the Makefile.PL, since that's used to actually create it)
perl Makefile.PL <bunch of messages> Writing Makefile for Net::SSLeay::Handle Writing Makefile for Net::SSLeay
Yay, a Makefile, now we can go and compile and install it..
make ; make install <compile messages> Installing /usr/share/man/man3/Net::SSLeay::Handle.3pm Installing /usr/share/man/man3/Net::SSLeay.3pm Writing /usr/lib/perl5/site_perl/5.8.1/i386-linux-thread-multi/auto/Net/SSLeay/.packlist Appending installation info to /usr/lib/perl5/5.8.1/i386-linux-thread-multi/perllocal.pod
Tadaa.., Net::SSLeay installed..
This is how CPAN can be used to install and/or update your perl modules to the latest versions..
|