On Red Hat 9 how to solve the following error?

```bash
FILE=perl-Image-ExifTool-13.10-1.el9.noarch.rpm
wget https://dl.fedoraproject.org/pub/epel/9/Everything/x86_64/Packages/p/$FILE
rpm2cpio $FILE | cpio -idv
./usr/bin/exiftool
```
```
Can't locate Image/ExifTool.pm in @INC (you may need to install the Image::ExifTool module) (@INC contains: /lustre/work/pdl16831/udlc74081/usr/bin/lib /usr/local/lib64/perl5/5.32 /usr/local/share/perl5/5.32 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at /lustre/work/pdl16831/udlc74081/usr/bin/exiftool line 41.
BEGIN failed--compilation aborted at /lustre/work/pdl16831/udlc74081/usr/bin/exiftool line 41.
```
Jun 3, 12:19pm

The error occurs because the Perl module Image::ExifTool is not found in the Perl module search path (@INC). When you extracted the RPM file using rpm2cpio and cpio, the module files were placed in a temporary directory (/lustre/work/pdl16831/udlc74081/usr/bin/), but Perl does not know to look there for modules.


Solution 1: Install the RPM Properly

The best approach is to install the RPM using dnf or yum instead of manually extracting it. This ensures all dependencies and paths are set correctly.

bash
sudo dnf install https://dl.fedoraproject.org/pub/epel/9/Everything/x86_64/Packages/p/perl-Image-ExifTool-13.10-1.el9.noarch.rpm

This will install the package and all its dependencies in the correct locations.


Solution 2: Manually Install the Module

If you must extract the RPM manually, you need to:

  1. Extract the RPM to the correct Perl module directory (e.g., /usr/local/share/perl5 or /usr/lib64/perl5/vendor_perl).
  2. Update @INC to include the directory where you extracted the module.

Steps:

  1. Extract the RPM to the correct location:

    bash
    sudo rpm2cpio perl-Image-ExifTool-13.10-1.el9.noarch.rpm | sudo cpio -idv --directory /usr/local

    This will place the module files in /usr/local/usr/bin/ and /usr/local/usr/lib/perl5/....

  2. Move the files to the correct Perl module directory:

    bash
    sudo mv /usr/local/usr/lib/perl5/vendor_perl/Image/ExifTool.pm /usr/local/share/perl5/
    sudo mv /usr/local/usr/lib/perl5/vendor_perl/Image/ExifTool /usr/local/share/perl5/
  3. Verify the module is in @INC:

    bash
    perl -e 'print join("\n", @INC)'

    If /usr/local/share/perl5 is not in the list, add it to the PERL5LIB environment variable:

    bash
    export PERL5LIB=/usr/local/share/perl5:$PERL5LIB

    To make this permanent, add the line to your ~/.bashrc or /etc/profile.

  4. Test:

    bash
    exiftool -ver

Solution 3: Use cpan to Install the Module

If you have cpan or cpanm (CPAN Minus) installed, you can install the module directly:

bash
sudo cpan Image::ExifTool

or

bash
sudo cpanm Image::ExifTool

Solution 4: Use the Full Path to the Script

If you only need to run exiftool once, you can use the full path to the script and set PERL5LIB temporarily:

bash
PERL5LIB=/lustre/work/pdl16831/udlc74081/usr/bin/lib:/lustre/work/pdl16831/udlc74081/usr/lib64/perl5/vendor_perl /lustre/work/pdl16831/udlc74081/usr/bin/exiftool

Recommendation

Use dnf install (Solution 1) for a clean, dependency-aware installation. If you must extract manually, ensure the module files are in a directory listed in @INC or update PERL5LIB.

Jun 3, 12:19pm

This is a shared conversation and may include unverified content that doesn't reflect Mistral AI's views. Login to resume chatting.

Vibe can make mistakes. Check answers. Learn more