---
name: "OpenBSD::PackingElement"
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::PackingElement"
---

# OpenBSD::PackingElement(3p)

"pkg\_add(1)" packing-elements object hierarchy

## NAME

OpenBSD::PackingElement - "pkg\_add(1)" packing-elements object hierarchy

## SYNOPSIS

```
    package OpenBSD::PackingElement;
    sub method
    {
    }
    package OpenBSD::PackingElement::Depend;
    sub method
    {
        my ($self, @args) = @_;
        # do something
    }
    package main;
    use OpenBSD::PackingList;
    $plist = OpenBSD::PackingList->fromfile($filename);
    $plist->visit('method', @args);
```

## DESCRIPTION

`"OpenBSD::PackingElement"` is the base class for all elements in a packing-list (see [**OpenBSD::PackingList**(3p)](/OpenBSD::PackingList/3p.md) and `pkg_create(1)`).

Manipulation of packing-lists mostly occurs through visitor patterns such as `"OpenBSD::PackingList::visit"`: client code defines a method for each relevant class in the hierarchy and calls `"$plist->visit('method')"` to perform the processing.

Most actual objects have one property: their `"name"`.

- ::Meta

  base class for all meta information that can be reordered at will.

  - ::Unique

    meta information with uniqueness properties.

    - ::Arch

      architecture requirements.

    - ::ExtraInfo

      some unique properties, like `"PKGPATH"` and allowed-for-ftp status.

    - ::Name

      the package name.

    - ::LocalBase

      the local base for the package.

    - ::NoDefaultConflict

      special annotation that package should not have any `"stem-*"` conflict marker.

    - ::SpecialFile

      special files like the package description or install script.

      - ::FCONTENTS

        contents file.

      - ::FDESC

        package description.

      - ::DisplayFile

        abstract class for special files that can be displayed. provides method `prepare($state)` to display the file.

        - ::FDISPLAY

          message displayed during package install.

        - ::FUNDISPLAY

          message displayed during package uninstall.

  - ::Option

    factory for `@option`

  - ::Comment

    comments in the packing-lists. The constructor is actually a factory, since some comments evolve to some other class.

  - ::CVSTag

    special class of comments that get reordered to the front of packing-lists.

  - ::Depend

    all dependency information.

    - ::Wantlib

      shared library needed for the package.

    - ::Dependency

      package needed, with the following properties: `"pkgpath"` is the path used to create the dependency, `"pattern"` is the [**OpenBSD::PkgSpec**(3p)](/OpenBSD::PkgSpec/3p.md) pattern used to match the dependency, `"def"` is the default value of the dependency computed during build, to use for comparing package signatures and to fulfill default dependencies.

  - ::Conflict

    conflict information.

- ::Annotation

  stuff that doesn't really exist as objects, but is used to add properties to objects.

  - ::Ignore

    mark next object as ignored.

  - ::sha

    mark last file with a checksum.

  - ::size

    mark last file with a size.

  - ::symlink

    mark last file as a symlink.

  - ::hardlink

    mark last file as a hardlink.

  - ::temp

    mark last file with a temporary name. Used during extraction of packages for replacement.

- ::Object

  somewhat concrete elements in packing-lists. This is the base class for objects with a location in the filesystem. It defineds method `"fullname"`, to access the complete name of the object.

  Note that all objects with file names use relative names except for `"::Extra"`, `"::Sample"` and `"::Sampledir"`

  - ::FileObject

    abstract class corresponding to files and directories. Default constructor depends on a `"dirclass"` property, that may create objects from another class if their name ends with a `"/"`. The full object name is normally computed relative to the current working directory as set in `"::State"`.

    - ::FileBase

      abstract class for files.

      - ::File

        actual file objects present in the packing-list.

      - ::InfoFile

        GNU info file objects.

      - ::Shell

        files with shell properties.

      - ::Manpage

        man pages.

      - ::Lib

        shared library files.

      - ::Sample

        file objects not present in the packing-list.

    - ::DirlikeObject

      abstract class for directories.

      - ::DirRm

        deprecated.

      - ::DirBase

        - ::Dir

          normal directory, with specialized versions.

          - ::Infodir

            directory holds GNU info files.

          - ::Fontdir

            directory holds X11 fonts.

          - ::Mandir

            directory is the root of a set of manpages.

          - ::Sampledir

            directory is used to hold configuration files or similar objects.

  - ::Action

    stuff that performs some action during addition/removal of package.

    - ::NewAuth

      - ::NewUser

        user that needs to be created for the package to work.

      - ::NewGroup

        group that needs to be created for the package to work.

    - ::ExeclikeAction

      escape mechanism for embedded code that needs to be run.

      - ::Exec

        code to run during installation.

      - ::Unexec

        code to run during deinstallation.

      - ::Extraunexec

        extra code to run during deinstallation with -c.

  - ::State

    annotation-like stuff that can't be easily moved around because it influences surrounding objects (mostly derived from `"::FileObject"`).

    - ::Cwd

      change the current working directory.

    - ::Owner

      change the current file owner.

    - ::Group

      change the current file group.

    - ::Mode

      change the current file mode.

## CAVEATS

Some aspects of this API are likely to change in the future, although the basic class hierarchy is now more or less worked out.
