OpenBSD::Search(3p) | Perl Programmers Reference Guide | OpenBSD::Search(3p)

# NAME

OpenBSD::Search - package names matching framework

# SYNOPSIS

       use OpenBSD::Search;
       # pkgspec objects
       my $search_object = OpenBSD::Search::PkgSpec->new($pattern);
       my $filter_object = OpenBSD::Search::Filter->keep_most_recent;
       # need repository to apply to
       use OpenBSD::PackageRepository::Installed;
       my $inst = OpenBSD::PackageRepository::Installed->new;
       my $list_ref = $inst->match_locations($search_object, $filter_object);

# DESCRIPTION

"OpenBSD::Search" provides a search infrastructure for "OpenBSD::PackageRepository" objects.

A given repository can be searched for existing packages using "$repo->match_locations($search1, $filter1, ...);"

It returns a reference to a list of matching "OpenBSD::PackageLocation" objects.

A repository list can be searched in a similar way: the search proceeds through each repository in the list, and stops as soon as it finds a non-empty match (similar to "ld -L" rules).

The first search object $search is used to find the basic set of matching packages, and further objects are used to weed out unwanted elements from the list.

Complex searches must be built as lists of filter objects, in order to preserve RepositoryList semantics, and ensure the correct non-empty first match is returned.

The infrastructure provides the following objects:

OpenBSD::Search::PkgSpec
  "OpenBSD::PkgSpec" filters.
OpenBSD::Search::Stem
  finds all packages with a given stem.
OpenBSD::Search::PartialStem
  finds all packages including a partial stem.
OpenBSD::Search::Filter
  filters package list through further tests.

2020-12-20 | perl v5.40.1