OpenBSD::PackageName(3p)

NAME
OpenBSD::PackageName - package names handling

SYNOPSIS
   use OpenBSD::PackageName;

   $pkgname = OpenBSD::PackageName::url2pkgname($url);

   ($stem, $version, @flavors) = OpenBSD::PackageName::splitname($pkgname);
   $stem = OpenBSD::PackageName::splitstem($pkgname);

   OpenBSD::PackageName::is_stem($stem) == 1;
   OpenBSD::PackageName::is_stem($pkgname) == 0;

   @candidates = OpenBSD::PackageName::findstem($stem, @pkgnames);
   # alternate interface
   $h = OpenBSD::PackageName::compile_stemlist(@pkgnames);
   @candidates = $h->findstem($stem);

DESCRIPTION
"OpenBSD::PackageName" is the canonical interface to package names handling.

OpenBSD::PackageName::url2pkgname($url)
    strip an $url of path elements and ".tgz" suffixes, yield a canonicalized package name.

OpenBSD::PackageName::splitname($pkgname)
    split a $pkgname into a $stem, a $version number, and a (possibly empty) list of @flavors components. If the name contains no identifiable version, $version will be "undef".

OpenBSD::PackageName::splitstem($pkgname)
    short version of "splitname" that extracts only the $stem.

OpenBSD::PackageName::is_stem($string)
    check whether a $string is a valid stem, as opposed to a full package name. Useful for commands that take either full names or stems, and need to reconstruct the full name from the stem.

"OpenBSD::PackageName::findstem($stem, @pkgnames)"
    look up a $stem into a list of @pkgnames. Return a list of candidates for further processing.

OpenBSD::PackageName::compile_stemlist(@pkgnames)
    alternate interface that is faster when lots of look ups are involved. Compile a list of @pkgnames into an object $h that can be queried using "$h->findstem($stem)".