Wednesday, May 03, 2006

cpan2rpm - perl modules and rpms

Today I discovered this amazingly useful utility. This helps in building the perl module rpms that are necessary for other perl module rpms (dependencies) to install.

If you have an rpm install, the dependent rpms need to be listed in the rpm database on your machine. The number 1 source for perl modules is CPAN but they don't necessarily release rpms for the modules. With the cpan2rpm, you can get the required perl module from CPAN, make the rpm and then install the module with rpm.

The really nice thing about cpan2rpm is that it can locate the module from CPAN automatically, for ex: if you invoke it like this: cpan2rpm XML::Simple, it will locate the XML::Simple module from CPAN, copy it over and build the rpm at /usr/src/redhat/RPMS/noarch/perl-XML-Simple-2.14-1.noarch.rpm.

Sometimes, cpan2rpm won't be able to find the module on CPAN. Then you can manually locate it from CPAN archives, download it and then point cpan2rm at the local gzip file and it will go ahead and build the rpm.

cpan2rpm /home/downloads/HTML-Format-1.23.tar.gz

Rather long winded - instead of simply installing the module, but if a latter part of the install uses rpm, you need to make sure the rpm database knows about the dependencies, so this is a necessary step.

Once again, it is a good thing that there's more than one way to do it!

No comments: