---
name: "OpenBSD::PkgSpec"
section: "3p"
platform: "openbsd"
package: "man"
version: "8.0-current-20261101"
release: "OpenBSD 8.0-current (2026-11-01)"
platforms: ["openbsd"]
url: "https://new.carta.tech/OpenBSD::PkgSpec"
---

# OpenBSD::PkgSpec(3p)

"packages-specs(7)" handling

## NAME

OpenBSD::PkgSpec - "[packages-specs(7)](/packages-specs/7.md)" handling

## SYNOPSIS

```
   use OpenBSD::Search; # which pulls in OpenBSD::PkgSpec when needed
   my $spec = OpenBSD::Search::PkgSpec->new($pattern);
   @sublist = $spec->filter(@list);
```

## DESCRIPTION

`"OpenBSD::PkgSpec"` is the canonical interface to `"packages-specs(7)"` handling.

A package specification `$pattern` is a string that can be used to extract matching package names from a `@list`.  The resulting list `@sublist` will only hold the package names that match the specification.

For performance reason, the result may contain duplicates.

Note that any pattern will create a `"PkgSpec"` object. If the syntax is incorrect, the resulting object won't match anything. Use `"$spec->is_valid"` to check for correctness.
