How to install perl modules

Ever called a perl script and got this?

Can't locate Regexp/Common.pm in @INC (@INC contains: SCRIPT /usr/lib/perl5/5.10.0/i586-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl/5.10.0/i586-linux-thread-multi /usr/lib/perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl/5.10.0/i586-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl .) at SCRIPT line 18.

Well, use zypper:

[email protected]#STABLE>sudo zypper in -C 'perl(Regexp::Common)'
Reading installed packages...

The following NEW package is going to be installed:

Easy, no?


Most modules follow the convention of packaging Foo::Bar in perl-Foo-Bar, but the above trick is really useful for those that don't:
$ rpm -q --whatprovides 'perl(Locale::gettext)'

By mvidner at Fri, 04/11/2008 - 12:31

thanks for the tip!

By mxttie at Sat, 04/12/2008 - 23:55

This only works, of course, if there's actually a package avilable on an enabled repository for the module you want to install. (I found this out recently when I tried to get Number::Format.)

By pgl at Sun, 04/13/2008 - 10:32