The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

NAME

RPM::Info

SYNOPSIS

#!/usr/bin/perl -w
my $rpm = new RPM::Info();
my @rpms = ();
my %filelist;
my %info;
my $dir = "";
my $info = "";
my @rpmreq = ();
my $seek = "gimp-1.2.3-360";
print "\nVer : ".$rpm->getRpmVer();
if ($rpm->getRpms(\@rpms, "gnome") == 0)
{
foreach (@rpms)
{
print "\nRPM:-> $_";
}
}
if ($rpm->getRpmFiles(\%filelist, $seek) == 0)
{
foreach $dir (keys(%filelist))
{
print "\n\n\nDir : $dir";
foreach (@{$filelist{$dir}{'files'}})
{
print "\nFile : $_";
}
}
}
if ($rpm->getRpmInfo(\%info, $seek) == 0)
{
print "\n\nINFOS:";
foreach $info (keys(%info))
{
print "\n$info : $info{$info}";
}
}
if ($rpm->getRpmRequirements(\@rpmreq, $seek) == 0)
{
print "\n\nREQUIREMENTS:";
foreach (@rpmreq)
{
print "\n$_";
}
}
if ($rpm->getRpmInfoRaw(\@rpms, "perl") == 0)
{
foreach (@rpms)
{
print "\nRPM:-> $_";
}
}
if ($rpm->getRpmDependents(\@rpms, "perl") == 0)
{
foreach (@rpms)
{
print "\nRPM:-> $_";
}
}

DESCRIPTION

The RPM::Info module allows to get informations about installed RPM's: it fetches: name, version, requirements, all files / directories containing to a RPM, information like vendor, distributor etc.

AUTHOR

Andreas Mahnke

Methods:

new

creates a new object of the class

getRpms(result(Array Reference), search pattern(scalar))

searches for all installed rpm's containing the search pattern
and saves them in an Array
if no search pattern is refered, all installed rpm's are saved
returns 0 on succes - 1 on failure

getRpmFiles((result(Hash Reference), rpmname(scalar))

searches for all files and directories which belong to the refered rpm - name
and saves them in a Hash of Hashes
returns 0 on succes - 1 on failure

getRpmVer()

gets the version of rpm and returns it

getRpmInfo((result(Hash Reference), rpmname(scalar))

gets Infos about the specified rpm and saves them into
a Hash of Hashes
returns 0 on succes - 1 on failure

getRpmRequirements((result(Array Reference), rpmname(scalar))

gets all the requirements of the specified rpm and saves them into an array
returns 0 on succes - 1 on failure

getRpmInfoRaw((result(Array Reference), rpmname(scalar))

gets Infos about the specified rpm and saves the output
line-by-line in an array
returns 0 on succes - 1 on failure

getRpmRequirements((result(Array Reference), rpmname(scalar))

gets all the rpm names that depend on the specified rpm
and saves them into an array
returns 0 on succes - 1 on failure