/usr/share/doc/lintian/api.html/Lintian/Data.html is in lintian 2.5.43.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><title>Lintian::Data</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>
<ul class='indexList indexList2'>
<li class='indexItem indexItem2'><a href='#Interface_for_the_CODE_argument'>Interface for the CODE argument</a>
</ul>
<li class='indexItem indexItem1'><a href='#CLASS_METHODS'>CLASS METHODS</a>
<li class='indexItem indexItem1'><a href='#INSTANCE_METHODS'>INSTANCE METHODS</a>
<li class='indexItem indexItem1'><a href='#DIAGNOSTICS'>DIAGNOSTICS</a>
<li class='indexItem indexItem1'><a href='#FILES'>FILES</a>
<li class='indexItem indexItem1'><a href='#AUTHOR'>AUTHOR</a>
<li class='indexItem indexItem1'><a href='#SEE_ALSO'>SEE ALSO</a>
</ul>
</div>
<h1><a class='u' href='#___top' title='click to go to top of document'
name="NAME"
>NAME</a></h1>
<p>Lintian::Data - Lintian interface to query lists of keywords</p>
<h1><a class='u' href='#___top' title='click to go to top of document'
name="SYNOPSIS"
>SYNOPSIS</a></h1>
<pre> my $keyword;
my $list = Lintian::Data->new('type');
if ($list->known($keyword)) {
# do something ...
}
my $hash = Lintian::Data->new('another-type', qr{\s++});
if ($list->value($keyword) > 1) {
# do something ...
}
my @keywords = $list->all;</pre>
<h1><a class='u' href='#___top' title='click to go to top of document'
name="DESCRIPTION"
>DESCRIPTION</a></h1>
<p>Lintian::Data provides a way of loading a list of keywords or key/value pairs from a file in the Lintian root and then querying that list. The lists are stored in the <em>data</em> directory of the Lintian root and consist of one keyword or key/value pair per line. Blank lines and lines beginning with <code>#</code> are ignored. Leading and trailing whitespace is stripped.</p>
<p>If requested, the lines are split into key/value pairs with a given separator regular expression. Otherwise, keywords are taken verbatim as they are listed in the file and may include spaces.</p>
<p>This module allows lists such as menu sections, doc-base sections, obsolete packages, package fields, and so forth to be stored in simple, easily editable files.</p>
<p>NB: By default Lintian::Data is lazy and defers loading of the data file until it is actually needed.</p>
<h2><a class='u' href='#___top' title='click to go to top of document'
name="Interface_for_the_CODE_argument"
>Interface for the CODE argument</a></h2>
<p>This section describes the interface between for the CODE argument for the class method new.</p>
<p>The sub will be called once for each key/pair with three arguments, KEY, VALUE and CURVALUE. The first two are the key/value pair parsed from the data file and CURVALUE is current value associated with the key. CURVALUE will be <code>undef</code> the first time the sub is called with that KEY argument.</p>
<p>The sub can then modify VALUE in some way and return the new value for that KEY. If CURVALUE is not <code>undef</code>, the sub may return <code>undef</code> to indicate that the current value should still be used. It is not permissible for the sub to return <code>undef</code> if CURVALUE is <code>undef</code>.</p>
<p>Where Perl semantics allow it, the sub can modify CURVALUE and the changes will be reflected in the result. As an example, if CURVALUE is a hashref, new keys can be inserted etc.</p>
<h1><a class='u' href='#___top' title='click to go to top of document'
name="CLASS_METHODS"
>CLASS METHODS</a></h1>
<dl>
<dt><a name="new(TYPE_[,SEPARATOR[,_CODE]])"
>new(TYPE [,SEPARATOR[, CODE]])</a></dt>
<dd>
<p>Creates a new Lintian::Data object for the given TYPE. TYPE is a partial path relative to the <em>data</em> directory and should correspond to a file in that directory. The contents of that file will be loaded into memory and returned as part of the newly created object. On error, new() throws an exception.</p>
<p>If SEPARATOR is given, it will be used as a regular expression for splitting the lines into key/value pairs.</p>
<p>If CODE is also given, it is assumed to be a sub that will pre-process the key/value pairs. See the <a href="#Interface_for_the_CODE_argument" class="podlinkpod"
>"Interface for the CODE argument"</a> above.</p>
<p>A given file will only be loaded once. If new() is called again with the same TYPE argument, the data previously loaded will be reused, avoiding multiple file reads.</p>
<dt><a name="set_vendor(PROFILE)"
>set_vendor(PROFILE)</a></dt>
<dd>
<p>Specifies vendor profile. It must be set before the first data file is loaded.</p>
</dd>
</dl>
<h1><a class='u' href='#___top' title='click to go to top of document'
name="INSTANCE_METHODS"
>INSTANCE METHODS</a></h1>
<dl>
<dt><a name="all()"
>all()</a></dt>
<dd>
<p>Returns all keywords listed in the data file as a list (in no particular order; the original order is not preserved). In a scalar context, returns the number of keywords.</p>
<dt><a name="known(KEYWORD)"
>known(KEYWORD)</a></dt>
<dd>
<p>Returns true if KEYWORD was listed in the data file represented by this Lintian::Data instance and false otherwise.</p>
<dt><a name="value(KEYWORD)"
>value(KEYWORD)</a></dt>
<dd>
<p>Returns the value attached to KEYWORD if it was listed in the data file represented by this Lintian::Data instance and the undefined value otherwise. If SEPARATOR was not given, the value will '1'.</p>
</dd>
</dl>
<h1><a class='u' href='#___top' title='click to go to top of document'
name="DIAGNOSTICS"
>DIAGNOSTICS</a></h1>
<dl>
<dt><a name="no_data_type_specified"
>no data type specified</a></dt>
<dd>
<p>new() was called without a TYPE argument.</p>
<dt><a name="unknown_data_type_%s"
>unknown data type %s</a></dt>
<dd>
<p>The TYPE argument to new() did not correspond to a file in the <em>data</em> directory of the Lintian root.</p>
<dt><a name="undefined_value_for_%s_(type:_%s)"
>undefined value for %s (type: %s)</a></dt>
<dd>
<p>The CODE argument return undef for the KEY and no previous value for that KEY was available.</p>
</dd>
</dl>
<h1><a class='u' href='#___top' title='click to go to top of document'
name="FILES"
>FILES</a></h1>
<dl>
<dt><a name="LINTIAN_INCLUDE_DIR/data"
>LINTIAN_INCLUDE_DIR/data</a></dt>
<dd>
<p>The files loaded by this module must be located in this directory. Relative paths containing a <code>/</code> are permitted, so files may be organized in subdirectories in this directory.</p>
<p>Note that lintian supports multiple LINTIAN_INCLUDE_DIRs.</p>
</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 Russ Allbery <rra@debian.org> for Lintian.</p>
<h1><a class='u' href='#___top' title='click to go to top of document'
name="SEE_ALSO"
>SEE ALSO</a></h1>
<p>lintian(1), <a href="https://lintian.debian.org/manual/section-2.6.html" class="podlinkurl"
>https://lintian.debian.org/manual/section-2.6.html</a></p>
<p class="backlinkbottom"><b><a name="___bottom" href="../index.html" title="All Documents"><<</a></b></p>
<!-- end doc -->
</body></html>
|