Product SiteDocumentation Site

17.2.4. Listing the name and version

The RPM2 module provides a handy subroutine for getting the NAME, VERSION, RELEASE, and EPOCH tags, often abbreviated as NVRE. The subroutine, as_nvre, returns a single string with these values in the standard format, with the values separated by minus signs.
Note
Usually, the EPOCH tag has no value. If there is an EPOCH value, you will see it output first, and then a colon, and then the name, version, and release values. For example:
5:redhat-config-httpd-1.0.1-13
In this case, the EPOCH value is 5.
You can call this subroutine on any header object, or any package object to get the full name of the package. For example:
print $header->as_nvre(), "\n";