Product SiteDocumentation Site

17.4. Where to Go from Here

One of the strengths of Perl is that there are so many add-on packages available. In addition, Perl is really strong in text processing. You can combine these strengths to provide cleaner output for RPM database queries, for example, avoiding the complex syntax for the --queryformat option to the rpm command. Perl can do more than the --queryformat option allows. For example, you can combine multiple values together into a Perl string and then format the output. The --queryformat option only allows formatting on each value individually, not groups of values.
In addition, you can combine one of the Perl templating modules, such as Text::Template or HTML::Template, to create an HTML page for a given package. You could use Perl to create formatted HTML pages for all the installed packages on your system, with HTML links to cross-reference all the dependencies.
Cross Reference
Download these modules from the CPAN site, www.cpan.org.
This chapter covers the RPM2 module. Right now, the RPM2 module supports only querying packages and the RPM database. Future versions will likely add the ability to install, update, and remove packages.
In addition to this module, you can find an RPM module with RPM::Header and RPM::Database classes. Another module, RPM::Specfile, provides the ability to turn Perl modules, such as those stored on CPAN, into RPM packages. The RPM::Specfile module helps create an RPM spec file for a Perl module.
The Perl-RPM-Perlonly bundle provides an alternative version of the RPM::Header module written entirely in Perl with no usage of the C rpm library. This makes RPM access much easier on platforms for which you don’t have the RPM system.
The RPM-Tools bundle includes RPM::Update, which compares the packages installed on your system (listed by calling rpm –qa) with the packages available on another system, that may be available only with a network link. This module can also update packages that are older than the designated master system. RPM::Make, also part of the RPM-Tools bundle, helps create RPM packages from a Perl script. This module does not support all the spec file options described in Chapter 9, Working with Spec Files , but it can help you make simple packages.
You can download all these modules from the CPAN site.