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

# NAME

OpenBSD::RequiredBy - manage installed package dependencies

# SYNOPSIS

        use OpenBSD::RequiredBy;
        # let's do things for real
        our $not = 0;
        my $o = OpenBSD::RequiredBy->new($pkgname);
        my $o2 = OpenBSD::Requiring->new($pkgname);
        print "Requirements for $pkgname are ", join(' ',$o2->list), "\n";
        # add some reverse dependencies
        $o->add($reverse_dep1, $reverse_dep2);
        # remove some dependency
        $o2->delete($dep);
        # forget some cache entry
        OpenBSD::RequiredBy->forget(installed_info($pkgname));
        # compute the transitive closure of some dependencies
        my @fulldeps = OpenBSD::Requiring->compute_closure($pkg1, $pkg2);

# DESCRIPTION

"OpenBSD::RequiredBy" handles lists of forward and reverse dependencies for installed packages.

If $main::not is true, all change operations are done internally and never written to disk.

"$o = OpenBSD::RequiredBy->new($pkgname)" gives access to the reverse dependencies, "$o =OpenBSD::Requiring->new($pkgname)" gives access to the forward dependencies.

Such an object can be used to list the dependencies "$o->list", add names to them "$o->add(name1, name2, ...)" or remove name from them "$o->delete(name1, name2, ...)".

The full list of forward dependencies (transitive closure) from a set of packages is given by "OpenBSD::RequiredBy->compute_closure($name1, name2, ...)". Likewise, "OpenBSD::Requiring->compute_closure($name1, name2, ...)" yields the list of reverse dependencies.

Those lists of dependencies trim duplicates and, unless $main::not is true, disk files are automatically synchronized whenever the lists change.

"OpenBSD::RequiredBy" maintains a cache for efficiency. When an installed package is deleted completely, "OpenBSD::RequiredBy->forget($dir)" and "OpenBSD::Requiring->forget($dir)" will remove the cache entries.

2020-12-20 | perl v5.40.1