man-pages/man3/Dpkg::Substvars.3perl.html
2021-03-31 01:06:50 +01:00

308 lines
6.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of Dpkg::Substvars</TITLE>
</HEAD><BODY>
<H1>Dpkg::Substvars</H1>
Section: libdpkg-perl (3perl)<BR>Updated: 2020-03-23<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
Dpkg::Substvars - handle variable substitution in strings
<A NAME="lbAC">&nbsp;</A>
<H2>DESCRIPTION</H2>
It provides an object which is able to substitute variables in strings.
<A NAME="lbAD">&nbsp;</A>
<H2>METHODS</H2>
<DL COMPACT>
<DT id="1">$s = Dpkg::Substvars-&gt;new($file)<DD>
Create a new object that can do substitutions. By default it contains
generic substitutions like ${Newline}, ${Space}, ${Tab}, ${dpkg:Version}
and ${dpkg:Upstream-Version}.
<P>
Additional substitutions will be read from the <TT>$file</TT> passed as parameter.
<P>
It keeps track of which substitutions were actually used (only counting
<B>substvars()</B>, not <B>get()</B>), and warns about unused substvars when asked to. The
substitutions that are always present are not included in these warnings.
<DT id="2">$s-&gt;set($key, $value)<DD>
Add/replace a substitution.
<DT id="3">$s-&gt;set_as_used($key, $value)<DD>
Add/replace a substitution and mark it as used (no warnings will be produced
even if unused).
<DT id="4">$s-&gt;set_as_auto($key, $value)<DD>
Add/replace a substitution and mark it as used and automatic (no warnings
will be produced even if unused).
<DT id="5">$s-&gt;get($key)<DD>
Get the value of a given substitution.
<DT id="6">$s-&gt;delete($key)<DD>
Remove a given substitution.
<DT id="7">$s-&gt;mark_as_used($key)<DD>
Prevents warnings about a unused substitution, for example if it is provided by
default.
<DT id="8">$s-&gt;no_warn($key)<DD>
Obsolete function, use <B>mark_as_used()</B> instead.
<DT id="9">$s-&gt;parse($fh, $desc)<DD>
Add new substitutions read from the filehandle. <TT>$desc</TT> is used to identify
the filehandle in error messages.
<P>
Returns the number of substitutions that have been parsed with success.
<DT id="10">$s-&gt;load($file)<DD>
Add new substitutions read from <TT>$file</TT>.
<DT id="11">$s-&gt;set_version_substvars($sourceversion, $binaryversion)<DD>
Defines ${binary:Version}, ${source:Version} and
${source:Upstream-Version} based on the given version strings.
<P>
These will never be warned about when unused.
<DT id="12">$s-&gt;<B>set_arch_substvars()</B><DD>
Defines architecture variables: ${Arch}.
<P>
This will never be warned about when unused.
<DT id="13">$s-&gt;<B>set_desc_substvars()</B><DD>
Defines source description variables: ${source:Synopsis} and
${source:Extended-Description}.
<P>
These will never be warned about when unused.
<DT id="14">$s-&gt;set_field_substvars($ctrl, $prefix)<DD>
Defines field variables from a Dpkg::Control object, with each variable
having the form ``${$prefix:$field}''.
<P>
They will never be warned about when unused.
<DT id="15">$newstring = $s-&gt;substvars($string)<DD>
Substitutes variables in <TT>$string</TT> and return the result in <TT>$newstring</TT>.
<DT id="16">$s-&gt;<B>warn_about_unused()</B><DD>
Issues warning about any variables that were set, but not used.
<DT id="17">$s-&gt;set_msg_prefix($prefix)<DD>
Define a prefix displayed before all warnings/error messages output
by the module.
<DT id="18">$s-&gt;filter(remove =&gt; $rmfunc)<DD>
<DT id="19">$s-&gt;filter(keep =&gt; $keepfun)<DD>
Filter the substitution variables, either removing or keeping all those
that return true when <TT>$rmfunc</TT>-&gt;($key) or <TT>$keepfunc</TT>-&gt;($key) is called.
<DT id="20">&quot;$s&quot;<DD>
Return a string representation of all substitutions variables except the
automatic ones.
<DT id="21">$str = $s-&gt;output([$fh])<DD>
Return all substitutions variables except the automatic ones. If <TT>$fh</TT>
is passed print them into the filehandle.
<DT id="22">$s-&gt;save($file)<DD>
Store all substitutions variables except the automatic ones in the
indicated file.
</DL>
<A NAME="lbAE">&nbsp;</A>
<H2>CHANGES</H2>
<A NAME="lbAF">&nbsp;</A>
<H3>Version 1.06 (dpkg 1.19.0)</H3>
New method: <TT>$s</TT>-&gt;<B>set_desc_substvars()</B>.
<A NAME="lbAG">&nbsp;</A>
<H3>Version 1.05 (dpkg 1.18.11)</H3>
Obsolete substvar: Emit an error on Source-Version substvar usage.
<P>
New return: <TT>$s</TT>-&gt;<B>parse()</B> now returns the number of parsed substvars.
<P>
New method: <TT>$s</TT>-&gt;<B>set_field_substvars()</B>.
<A NAME="lbAH">&nbsp;</A>
<H3>Version 1.04 (dpkg 1.18.0)</H3>
New method: <TT>$s</TT>-&gt;<B>filter()</B>.
<A NAME="lbAI">&nbsp;</A>
<H3>Version 1.03 (dpkg 1.17.11)</H3>
New method: <TT>$s</TT>-&gt;<B>set_as_auto()</B>.
<A NAME="lbAJ">&nbsp;</A>
<H3>Version 1.02 (dpkg 1.16.5)</H3>
New argument: Accept a <TT>$binaryversion</TT> in <TT>$s</TT>-&gt;<B>set_version_substvars()</B>,
passing a single argument is still supported.
<P>
New method: <TT>$s</TT>-&gt;<B>mark_as_used()</B>.
<P>
Deprecated method: <TT>$s</TT>-&gt;<B>no_warn()</B>, use <TT>$s</TT>-&gt;<B>mark_as_used()</B> instead.
<A NAME="lbAK">&nbsp;</A>
<H3>Version 1.01 (dpkg 1.16.4)</H3>
New method: <TT>$s</TT>-&gt;<B>set_as_used()</B>.
<A NAME="lbAL">&nbsp;</A>
<H3>Version 1.00 (dpkg 1.15.6)</H3>
Mark the module as public.
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="23"><A HREF="#lbAB">NAME</A><DD>
<DT id="24"><A HREF="#lbAC">DESCRIPTION</A><DD>
<DT id="25"><A HREF="#lbAD">METHODS</A><DD>
<DT id="26"><A HREF="#lbAE">CHANGES</A><DD>
<DL>
<DT id="27"><A HREF="#lbAF">Version 1.06 (dpkg 1.19.0)</A><DD>
<DT id="28"><A HREF="#lbAG">Version 1.05 (dpkg 1.18.11)</A><DD>
<DT id="29"><A HREF="#lbAH">Version 1.04 (dpkg 1.18.0)</A><DD>
<DT id="30"><A HREF="#lbAI">Version 1.03 (dpkg 1.17.11)</A><DD>
<DT id="31"><A HREF="#lbAJ">Version 1.02 (dpkg 1.16.5)</A><DD>
<DT id="32"><A HREF="#lbAK">Version 1.01 (dpkg 1.16.4)</A><DD>
<DT id="33"><A HREF="#lbAL">Version 1.00 (dpkg 1.15.6)</A><DD>
</DL>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:39 GMT, March 31, 2021
</BODY>
</HTML>