---
name: "Debian::Package::Dependency_List"
section: "3pm"
platform: "linux"
package: "pkg-order"
version: "1.12"
release: "Debian 2.2 (Potato)"
platforms: ["linux"]
url: "https://new.carta.tech/Debian::Package::Dependency_List"
---

# Debian::Package::Dependency\_List(3pm)

```
  Debian::Package::Dependency_List - Handle dependencies for packages.
```

```
      use Debian::Package::Dependency_List;

      # initialize the dependency list object using the value of the
      # Pre-Depends, Dependes, Recommends, or Suggests field values.
      $dep_lst =
        Debian::Package::Dependency_List->new('string' => "Value");

      # Print it back out again
      $dep_lst->print();

      # Exercise new and print
      Debian::Package::Dependency_List->test_relations();
```

This module implements a Debian::Package::Dependency\_List object. This object may then be used to perform dependency checks, or to decide on the correct order to build/install the packages.\
 **new** This is the constructor for the package.  It takes a named argument, *string*, whose value is the value of the Pre-Depends, Dependes, Recommends, Suggests, Conflicts, or Replaces field values for the package (it is expected that one Debian::Package::Dependency\_List object shall be created for each of those fields, if they exist). It also takes a named argument *Package*, which is the name of the package under consideration. The final named argument, *Type*,  holds the name of the field.\
 Internally, new uses the method **initialize**, which parses the string and creates a new Dependency object for each element. And calls add to add each element to the list. Like new, It takes named arguments, *string*, *Package*, and *Type*. \
 **add** This method adds a new dependency to the list. It also handles alternates as a simple linked list branching off from the associative array which is the Dependency\_list object. Like new, It takes named arguments, *string*, *Package*, and *Type*, except in this case the string represents a fragment of the dependency line corresponding to each element (it represents the text in between commas)\
 **delete** This routine take a required named argument Name and deletes a package with that name from the list if it exists. It also take care of erasing the package from the provides list, if indeed this package provided a virtual package.\
 **delete** This routine take a required named argument Name and deletes a dependency with that name from the list if it exists. \
 **print** This method takes the internal representation of a dependency list (complete with alternatives) and produces a string, which should be the string used to initialize the object.\
 **match** This routine takes a dependency object as an argument, and returns 'Yes' if that dependency object is identical to  a member of the dependency list.\
 **depend**  This method performs dependency checks for all elements of the dependency list. It takes required named argument *Package*, which is a pointer to the package to which this dependency list belongs. It also takes optional named argument *Conflicts* (true if this is a conflicts list). It cycles through all dependencies, calling the depend method of each dependency object, handling alternates as it goes.\
 **order**  This method takes a named argument, New, which is a pointer to the new packages list, and a named parameter Package, which is a pointer to the package this dependency list belongs to (the results are appended to the package object).\
 **test** A class  method has been provided to test the Dependency\_list class, and the undelying class **Debian::Package::Dependency**. The following test set of dependency strings are used\
\
\
\
\
 This is very inchoate, at the moment, and needs testing. None Known so far. Manoj Srivastava \<srivasta@debian.org\>
