The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


CPANPLUS::Dist::RPM - a CPANPLUS backend to build RPM


    cpan2dist --format=CPANPLUS::Dist::RPM Some::Random::Package


CPANPLUS::Dist::RPM is a distribution class to create RPM packages from CPAN modules, and all its dependencies. This allows you to have the most recent copies of CPAN modules installed, using your package manager of choice, but without having to wait for central repositories to be updated.

You can either install them using the API provided in this package, or manually via rpm.

Note that these packages are built automatically from CPAN and are assumed to have the same license as perl and come without support. Please always refer to the original CPAN package if you have questions.


$bool = CPANPLUS::Dist::RPM->format_available;

Return a boolean indicating whether or not you can use this package to create and install modules in your environment.

It will verify if you have all the necessary components available to build your own rpm packages. You will need at least these dependencies installed: rpm, rpmbuild and gcc.


$bool = $rpm->init;

Sets up the CPANPLUS::Dist::RPM object for use. Creates all the needed status accessors.

Called automatically whenever you create a new CPANPLUS::Dist object.

$bool = $rpm->prepare;

Prepares a distribution for creation. This means it will create the rpm spec file needed to build the rpm and source rpm. This will also satisfy any prerequisites the module may have.

Note that the spec file will be as accurate as possible. However, some fields may wrong (especially the description, and maybe the summary) since it relies on pod parsing to find those information.

Returns true on success and false on failure.

You may then call $rpm->create on the object to create the rpm from the spec file, and then $rpm->install on the object to actually install it.

$bool = $rpm->create;

Builds the rpm file from the spec file created during the create() step.

Returns true on success and false on failure.

You may then call $rpm->install on the object to actually install it.

$bool = $rpm->install;

Installs the rpm using rpm -U.

/!\ Work in progress: not implemented.

Returns true on success and false on failure


These are only documented here as it may be useful to override them.


Prepare our $status.


Generate and write out the spec file.


Checks to see if an RPM for this module is already installed on the system. Note that we only check the rpmdb; we leave checking package repos to distribution-specific subclasses.


Takes no arguments; returns a hashref of the buildrequires of this module.


Takes no arguments; returns an arrayref of the files which should be included as %doc in the spec.


Takes no arguments; returns true if the module is pure-perl; false otherwise.


Return true if the Makefile.PL is actually a front for Module::Build.


If passed an argument, makes an rpm package name out of it; returns the rpm package name of the module we're operating against if none given.


Get the one-liner summary of the module for %summary.


Get the module's description for %description.


Get the module's license for License:. Note that while this is still incomplete, we now use Software::License to try to figure out the correct license from the .pm/.pod files.


This particular base class does not endeavour to satisfy any Linux distribution's packaging guidelines. It does, however, strive to create clean, sane specs and resulting rpm packages.

Until subclassing, users should not be surprised to note a marked similarity to the Fedora/RedHat Perl packaging guidelines.


o Deeper scan for proper license

We do use Software::License to scan any .pm/.pod files. However, we could and should be checking META.yml and any COPYING/LICENSE files that happen to be bundled.

o Long description

Right now we provide the description as given by the module in its meta data. However, not all modules provide this meta data and rather than scanning the files in the package for it, we simply default to the name of the module.


Please report any bugs or feature requests to < bug-CPANPLUS-Dist-RPM at>, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


CPANPLUS::Backend, CPANPLUS::Module, CPANPLUS::Dist, cpan2dist, rpm

CPANPLUS::Dist::RPM development takes place at

You can also look for information on this module at:


Originally based on CPANPLUS-Dist-Mdv by:

Jerome Quelin, <jquelin at>

Shlomi Fish ( ) changed it into CPANPLUS-Dist-Fedora.

Chris Weyl <> changed it again to CPANPLUS-Dist-RPM.


Copyright (c) 2007 Jerome Quelin, Shlomi Fish, Chris Weyl.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Modified by Shlomi Fish, 2008 - all ownership disclaimed.

Modified again by Chris Weyl <> 2008.