4.8. How to handle RPM packages with Perls scripts

Since RHEL 8, the Perl programming language is not included in the default buildroot. Therefore, the RPM packages that include Perl scripts must explicitly indicate the dependency on Perl using the BuildRequires: directive in RPM SPEC file.

4.8.2. Using a specific Perl module

If a specific Perl module is required at build time, use the following procedure:


  • Apply the following syntax in your RPM SPEC file:

    BuildRequires: perl(MODULE)

    Apply this syntax to Perl core modules as well, because they can move in and out of the perl package over time.

4.8.3. Limiting a package to a specific Perl version

To limit your package to a specific Perl version, follow this procedure:


  • Use the perl(:VERSION) dependency with the desired version constraint in your RPM SPEC file:

    For example, to limit a package to Perl version 5.30 and higher, use:

    BuildRequires: perl(:VERSION) >= 5.30

Do not use a comparison against the version of the perl package because it includes an epoch number.

4.8.4. Ensuring that a package uses the correct Perl interpreter

Red Hat provides multiple Perl interpreters, which are not fully compatible. Therefore, any package that delivers a Perl module must use at run time the same Perl interpreter that was used at build time.

To ensure this, follow the procedure below:


  • Include versioned MODULE_COMPAT Requires in RPM SPEC file for any package that delivers a Perl module:

    Requires:  perl(:MODULE_COMPAT_%(eval `perl -V:version`; echo $version))