Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 18.191.144.15
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><title>Lintian::DepMap</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" title="blkbluw" type="text/css" href="../_blkbluw.css" media="all" >
<link rel="alternate stylesheet" title="blkmagw" type="text/css" href="../_blkmagw.css" media="all" >
<link rel="alternate stylesheet" title="blkcynw" type="text/css" href="../_blkcynw.css" media="all" >
<link rel="alternate stylesheet" title="whtprpk" type="text/css" href="../_whtprpk.css" media="all" >
<link rel="alternate stylesheet" title="whtnavk" type="text/css" href="../_whtnavk.css" media="all" >
<link rel="alternate stylesheet" title="grygrnk" type="text/css" href="../_grygrnk.css" media="all" >
<link rel="alternate stylesheet" title="whtgrng" type="text/css" href="../_whtgrng.css" media="all" >
<link rel="alternate stylesheet" title="blkgrng" type="text/css" href="../_blkgrng.css" media="all" >
<link rel="alternate stylesheet" title="grygrnw" type="text/css" href="../_grygrnw.css" media="all" >
<link rel="alternate stylesheet" title="blkbluw" type="text/css" href="../_blkbluw.css" media="all" >
<link rel="alternate stylesheet" title="whtpurk" type="text/css" href="../_whtpurk.css" media="all" >
<link rel="alternate stylesheet" title="whtgrng" type="text/css" href="../_whtgrng.css" media="all" >
<link rel="alternate stylesheet" title="grygrnw" type="text/css" href="../_grygrnw.css" media="all" >
<script type="text/javascript" src="../_podly.js"></script>
</head>
<body class='pod'>
<!-- start doc -->
<p class="backlinktop"><b><a name="___top" href="../index.html" accesskey="1" title="All Documents"><<</a></b></p>
<div class='indexgroup'>
<ul class='indexList indexList1'>
<li class='indexItem indexItem1'><a href='#NAME'>NAME</a>
<li class='indexItem indexItem1'><a href='#SYNOPSIS'>SYNOPSIS</a>
<li class='indexItem indexItem1'><a href='#DESCRIPTION'>DESCRIPTION</a>
<li class='indexItem indexItem1'><a href='#AUTHOR'>AUTHOR</a>
</ul>
</div>
<h1><a class='u' href='#___top' title='click to go to top of document'
name="NAME"
>NAME</a></h1>
<p>Lintian::DepMap - Dependencies map/tree creator</p>
<h1><a class='u' href='#___top' title='click to go to top of document'
name="SYNOPSIS"
>SYNOPSIS</a></h1>
<pre> use Lintian::DepMap;
my $map = Lintian::DepMap->new;
# know about A:
$map->add('A');
# B depends on A:
$map->add('B', 'A');
# prints 'A':
print $map->selectable;
# indicate we are working on 'A' (optional):
$map->select('A');
# do 'A' ... work work work
# we are done with A:
$map->satisfy('A');
# prints 'B':
print $map->selectable;</pre>
<h1><a class='u' href='#___top' title='click to go to top of document'
name="DESCRIPTION"
>DESCRIPTION</a></h1>
<p>Lintian::DepMap is a simple dependencies map/tree creator and "resolver". It works by creating a tree based on the indicated dependencies and destroying it to resolve it.</p>
<p>Note: in the below documentation a <code>node</code> means a node name; no internal reference is ever returned and therefore never accepted as a parameter.</p>
<dl>
<dt><a name="new()"
>new()</a></dt>
<dd>
<p>Creates a new Lintian::DepMap object and returns a reference to it.</p>
<dt><a name="initialise()"
>initialise()</a></dt>
<dd>
<p>Ensure, by reconstructing if necessary, the map's status is the initial. That is, partially or fully resolved maps can be restored to its original state by calling this method.</p>
<p>This can be useful when the same map will be used multiple times.</p>
<p>E.g.</p>
<pre> $map->add('A');
$map->satisfy('A');
# prints nothing
print $map->selectable;
$map->initialise;
print $map->selectable;</pre>
<dt><a name="add(node[,_dependency[,_dependency[,_...]]])"
>add(node[, dependency[, dependency[, ...]]])</a></dt>
<dd>
<p>Adds the given <code>node</code> to the map marking any second or more parameter as its dependencies. E.g.</p>
<pre> # A has no dependency:
$map->add('A');
# B depends on A:
$map->add('B', 'A');</pre>
<dt><a name="addp(node[,_prefix,_dependency[,_dependency[,_...]]])"
>addp(node[, prefix, dependency[, dependency[, ...]]])</a></dt>
<dd>
<p>Adds the given <code>node</code> to the map marking any third or more parameters, after prefixing them with <code>prefix</code>, as its dependencies. E.g.</p>
<pre> # pA and pB have no dependency:
$map->add('pA');
$map->add('pA');
# C depends on pA and pB:
$map->addp('C', 'p', 'A', 'B');</pre>
<dt><a name="satisfy(node)"
>satisfy(node)</a></dt>
<dd>
<p>Indicates that the given <code>node</code> has been satisfied/done.</p>
<p>The given <code>node</code> is no longer marked as being selected, if it was; all of its branches that have no other parent are now selectable() and all the references to <code>node</code> are deleted except the one from the known() list.</p>
<p>E.g.</p>
<pre> # A has no dependencies:
$map->add('A');
# B depends on A:
$map->add('B', 'A');
# we work on A, and we are done:
$map->satisfy('A');
# B is now available:
$map->selectable('B');</pre>
<p><b>Note</b>: shall the requested node not exist this method die()s.</p>
<dt><a name="done(node)"
>done(node)</a></dt>
<dd>
<p>Returns whether the given <code>node</code> has been satisfied/done.</p>
<p>E.g.</p>
<pre> # A has no dependencies:
$map->add('A');
# we work on A, and we are done:
$map->satisfy('A');
print "A is done!"
if ($map->done('A'));</pre>
<dt><a name="unlink(node)"
>unlink(node)</a></dt>
<dd>
<p>Removes all references to the given <code>node</code> except for the entry in the known() table.</p>
<p><b>IMPORTANT</b>: since all references are deleted it is possible that a node that depended on <code>node</code> may become available even when it was not expected to.</p>
<p><b>IMPORTANT</b>: this operation can <b>not</b> be reversed by the means of initialise().</p>
<p>E.g.</p>
<pre> $map->add('A');
# Prints A
print $map->selectable;
# we later notice we don't want A
$map->unlink('A');
# Prints nothing
print $map->selectable;</pre>
<p><b>Note</b>: shall the requested node not exist this method die()s.</p>
<dt><a name="select(node)"
>select(node)</a></dt>
<dd>
<p>Marks the given <code>node</code> as selected to indicate that whatever it represents is being worked on. Note: this operation is not atomic.</p>
<p>E.g.</p>
<pre> $map->add('A');
$map->add('B', 'A');
while($map->pending) {
for my $node ($map->selectable) {
$map->select($node);
# work work work
$map->satisfy($node);
}
}</pre>
<dt><a name="selectable([node])"
>selectable([node])</a></dt>
<dd>
<p>If a <code>node</code> is specified returns TRUE if it can be select()ed.</p>
<p><b>Note</b>: already select()ed nodes cannot be re-selected, i.e. if the given <code>node</code> has already been selected this function will return FALSE; or any selected item will be omitted from the returned array, in case no <code>node</code> is specified.</p>
<dt><a name="selected([node])"
>selected([node])</a></dt>
<dd>
<p>If a <code>node</code> is specified returns TRUE if it is has been selected, FALSE otherwise.</p>
<p>If no <code>node</code> is specified it returns an array with the name of all the nodes that have been select()ed but not yet satisfied.</p>
<p>E.g.</p>
<pre> # We are going to work on A
$map->select('A');
# Returns true
$map->selected('A');
# Prints A
print $map->selected;</pre>
<dt><a name="selectAll()"
>selectAll()</a></dt>
<dd>
<p>select()s all the selectable() nodes.</p>
<dt><a name="parents(node)"
>parents(node)</a></dt>
<dd>
<p>Return an array with the name of the parent nodes for the given <code>node</code>.</p>
<p>E.g.</p>
<pre> $map->add('A');
$map->add('B', 'A');
# Prints 'A'
print $map->parents('B');</pre>
<p><b>Note</b>: shall the requested node not exist this method die()s.</p>
<dt><a name="pending()"
>pending()</a></dt>
<dd>
<p>Return the number of nodes that can or have already been selected. E.g.</p>
<pre> $map->add('B', 'A');
# prints 1:
print $map->pending;
$map->select('A');
# prints 1:
print $map->pending;
$map->satisfy('A');
# prints 1 ('B' is now available):
print $map->pending;</pre>
<dt><a name="known()"
>known()</a></dt>
<dd>
<p>Return an array containing the names of nodes that were added. E.g.</p>
<pre> $map->add('B', 'A');
# prints 'B':
print $map->known;
$map->add('A');
# prints 'A' and 'B':
print $map->known;</pre>
<dt><a name="known(NODE)"
>known(NODE)</a></dt>
<dd>
<p>Returns a truth value if NODE is known or <code>undef</code> otherwise.</p>
<dt><a name="missing()"
>missing()</a></dt>
<dd>
<p>Return an array containing the names of nodes that were not added but that another node depended on it. E.g.</p>
<pre> $map->add('B', 'A');
# prints 'A':
print $map->missing;
$map->add('A');
# prints nothing:
print $map->missing;
# this also works; A depends on 'Z':
$map->add('A', 'Z');
# but now this prints 'Z':
print $map->missing;</pre>
<dt><a name="circular(['deep'])"
>circular(['deep'])</a></dt>
<dd>
<p>Returns an array of nodes that have a circular dependency.</p>
<p>E.g.</p>
<pre> $map->add('A', 'B');
$map->add('B', 'A');
# Prints A and B
print $map->circular;</pre>
<p><b>Note</b>: since recursive/deep circular dependencies detection is a bit more resource expensive it is not the default.</p>
<pre> $map->add('A', 'B');
$map->add('B', 'C');
$map->add('C', 'A');
# No deep/recursive scanning is performed, prints nothing
print $map->circular;
# deep scan, prints 'A, B, C'
print $map->circular('deep');</pre>
</dd>
</dl>
<h1><a class='u' href='#___top' title='click to go to top of document'
name="AUTHOR"
>AUTHOR</a></h1>
<p>Originally written by Raphael Geissert <atomo64@gmail.com> for Lintian.</p>
<p class="backlinkbottom"><b><a name="___bottom" href="../index.html" title="All Documents"><<</a></b></p>
<!-- end doc -->
</body></html>
|