1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4
<title>Fink::Services - perldoc.perl.org</title>
5
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
6
<meta http-equiv="Content-Language" content="en-gb" />
7
<link href="../css.css" rel="stylesheet" rev="stylesheet" type="text/css" media="screen" />
10
<script language="JavaScript" type="text/javascript" src="../label.js"></script>
12
<script language="JavaScript">
17
<body onLoad="showToolbars();loadLabels()">
20
<div id="pageHeaderLogo">
21
<img src="../onion.gif">
23
<div id="pageHeaderText">
24
<a href="http://perldoc.perl.org">perldoc.perl.org</a>
30
<div id="leftContent">
32
<a href="#" onClick="closeLeft()" title="Hide navigation" onmouseover="leftCloseIcon.src='../close_purple.gif';" onmouseout="leftCloseIcon.src='../close_blue.gif';"><img src="../close_blue.gif" name="leftCloseIcon" id="leftCloseIcon" border=0></a>
36
<li><a href="../index-overview.html">Overview</a></li>
37
<li><a href="../index-tutorials.html">Tutorials</a></li>
38
<li><a href="../index-faq.html">FAQs</a></li>
39
<li><a href="../index-history.html">History / Changes</a></li>
40
<li><a href="../index-licence.html">Licence</a></li>
44
<li><a href="../index-language.html">Language</a></li>
45
<li><a href="../index-functions.html">Functions</a></li>
46
<li><a href="../perlop.html">Operators</a></li>
47
<li><a href="../perlvar.html">Special variables</a></li>
48
<li><a href="../index-pragmas.html">Pragmas</a></li>
49
<li><a href="../index-modules-A.html">Core modules</a></li>
50
<li><a href="../index-utilities.html">Utilities</a></li>
51
<li><a href="../index-internals.html">Internals</a></li>
52
<li><a href="../index-platforms.html">Platform specific</a></li>
56
<li><a href="http://search.cpan.org">CPAN</a></li>
57
<li><a href="http://www.perl.com">Perl.com</a></li>
58
<li><a href="http://www.perl.org">Perl.org</a></li>
59
<li><a href="http://www.pm.org">Perl Mongers</a></li>
60
<li><a href="http://www.perlmonks.org">Perl Monks</a></li>
61
<li><a href="http://planet.perl.org">Planet Perl</a></li>
62
<li><a href="http://use.perl.org">Use Perl</a></li>
66
<li>Site maintained by<br><a href="http://perl.jonallen.info">Jon Allen</a>
67
(<a href="http://perl.jonallen.info">JJ</a>)</li>
68
<li class="spaced">Last updated on<br>23 April 2006</li>
69
<li class="spaced">See the <a href="http://perl.jonallen.info/projects/perldoc">project page</a> for
76
<div id="centerContent">
77
<div id="contentHeader">
78
<div id="contentHeaderLeft"><a href="#" onClick="showLeft()">Show navigation</a></div>
79
<div id="contentHeaderCentre">-- Perl 5.8.8 documentation --</div>
80
<div id="contentHeaderRight"><a href="#" onClick="showRight()">Show toolbar</a></div>
82
<div id="breadCrumbs"><a href="../index.html">Home</a> > <a href="../index-modules-A.html">Core modules</a> > <a href="../index-modules-F.html">F</a> > Fink::Services</div>
83
<script language="JavaScript">fromSearch();</script>
84
<div id="contentBody"><div class="title_container"><div class="page_title">Fink::Services</div></div><ul><li><a href="#NAME">NAME</a><li><a href="#SYNOPSIS">SYNOPSIS</a><li><a href="#DESCRIPTION">DESCRIPTION</a><ul><li><a href="#Functions">Functions</a></ul></ul><a name="NAME"></a><h1>NAME</h1>
85
<p>Fink::Services - functions for text processing and system interaction</p>
86
<a name="SYNOPSIS"></a><h1>SYNOPSIS</h1>
87
<a name="DESCRIPTION"></a><h1>DESCRIPTION</h1>
88
<p>These functions handle a variety of text (file and string) parsing and
89
system interaction tasks.</p>
90
<a name="Functions"></a><h2>Functions</h2>
91
<p>No functions are exported by default. You can get whichever ones you
92
need with things like:</p>
93
<pre class="verbatim"> <a class="l_k" href="../functions/use.html">use</a> <a class="l_w" href="../Fink/Services.html">Fink::Services</a> <span class="q">'&read_config'</span><span class="sc">;</span>
94
<a class="l_k" href="../functions/use.html">use</a> <a class="l_w" href="../Fink/Services.html">Fink::Services</a> <span class="q">qw(&execute_script &expand_percent)</span><span class="sc">;</span></pre>
96
<li><a name="read_config"></a><b>read_config</b>
97
<pre class="verbatim"> <a class="l_k" href="../functions/my.html">my</a> <span class="i">$config</span> = read_config <span class="i">$filename</span><span class="sc">;</span>
98
<a class="l_k" href="../functions/my.html">my</a> <span class="i">$config</span> = read_config <span class="i">$filename</span><span class="cm">,</span> \<span class="i">%defaults</span><span class="sc">;</span></pre>
99
<p>Reads a fink.conf file given by $filename into a new Fink::Config
100
object and initializes Fink::Config globals from it. If %defaults is
101
given they will be used as defaults for any keys not in the config
102
file. The new object is returned.</p>
104
<li><a name="read_properties"></a><b>read_properties</b>
105
<pre class="verbatim"> <a class="l_k" href="../functions/my.html">my</a> <span class="i">$property_hash</span> = read_properties <span class="i">$filename</span><span class="sc">;</span>
106
<a class="l_k" href="../functions/my.html">my</a> <span class="i">$property_hash</span> = read_properties <span class="i">$filename</span><span class="cm">,</span> <span class="i">$notLC</span><span class="sc">;</span></pre>
107
<p>Reads a text file $filename and returns a ref to a hash of its
108
fields. See the description of read_properties_lines for more
110
<p>If $filename cannot be read, program will die with an error message.</p>
112
<li><a name="read_properties_var"></a><b>read_properties_var</b>
113
<pre class="verbatim"> <a class="l_k" href="../functions/my.html">my</a> <span class="i">$property_hash</span> = read_properties_var <span class="i">$filename</span><span class="cm">,</span> <span class="i">$string</span><span class="sc">;</span>
114
<a class="l_k" href="../functions/my.html">my</a> <span class="i">$property_hash</span> = read_properties_var <span class="i">$filename</span><span class="cm">,</span> <span class="i">$string</span><span class="cm">,</span> <span class="i">$notLC</span><span class="sc">;</span></pre>
115
<p>Parses the multiline text $string and returns a ref to a hash of
116
its fields. See the description of read_properties_lines for more
117
information. The string $filename is used in parsing-error messages
118
but the file is not accessed.</p>
120
<li><a name="read_properties_lines"></a><b>read_properties_lines</b>
121
<pre class="verbatim"> <a class="l_k" href="../functions/my.html">my</a> <span class="i">$property_hash</span> = read_properties_lines <span class="i">$filename</span><span class="cm">,</span> <span class="i">$notLC</span><span class="cm">,</span> <span class="i">@lines</span><span class="sc">;</span></pre>
122
<p>This is function is not exported. You should use read_properties_var,
123
read_properties, or read_properties_multival instead.</p>
124
<p>Parses the list of text strings @lines and returns a ref to a hash of
125
its fields. The string $filename is used in parsing-error messages but
126
the file is not accessed.</p>
127
<p>If $notLC is true, fields are treated in a case-sensitive manner. If
128
$notLC is false (including undef), field case is ignored (and
129
cannonicalized to lower-case). In functions where passing $notLC is
130
optional, not passing is equivalent to false.</p>
131
<p>See the Fink Packaging Manual, section 2.2 "File Format" for
132
information about the format of @lines text.</p>
133
<p>If errors are encountered while parsing @lines, messages are sent to
134
STDOUT, but whatever (possibly incorrect) parsing is returned anyway.
135
The following situations are checked:</p>
136
<pre class="verbatim"> More than one occurance of a key. In this situation, the last
137
occurance encountered in @lines is the one returned. Note that the
138
same key can occur in the main package and/or different splitoff
139
packages, up to one time in each.</pre><pre class="verbatim"> Use of RFC-<span class="n">822</span>-style multilining <span class="s">(</span>whitespace indent of second and
140
subsequent lines<span class="s">)</span>. This notation has been deprecated in favor of
141
heredoc notation.</pre>
142
<pre class="verbatim"> Any unknown/invalid syntax.</pre>
143
<pre class="verbatim"> Reaching the end of <span class="i">@lines</span> while a heredoc multiline value is still
144
<a class="l_k" href="../functions/open.html">open</a>.</pre>
145
<p>Note that no check is made for the validity of the fields being in the
146
file in which they were encountered. The filetype (fink.conf, *.info,
147
etc.) is not necessarily known and this routine is used for many
148
different filetypes.</p>
149
<p>Multiline values (including all the lines of fields in a splitoff) are
150
returned as a single multiline string (i.e., with embedded \n), not as
151
a ref to another hash or array.</p>
153
<li><a name="read_properties_multival"></a><b>read_properties_multival</b>
154
<pre class="verbatim"> <a class="l_k" href="../functions/my.html">my</a> <span class="i">$property_hash</span> = read_properties_multival <span class="i">$filename</span><span class="sc">;</span>
155
<a class="l_k" href="../functions/my.html">my</a> <span class="i">$property_hash</span> = read_properties_multival <span class="i">$filename</span><span class="cm">,</span> <span class="i">$notLC</span><span class="sc">;</span></pre>
156
<p>Reads a text file $filename and returns a ref to a hash of its fields,
157
with each value being a ref to a list of values for that field. See
158
the description of read_properties_multival_lines for more
160
<p>If $filename cannot be read, program will die with an error message.</p>
162
<li><a name="read_properties_multival_var"></a><b>read_properties_multival_var</b>
163
<pre class="verbatim"> <a class="l_k" href="../functions/my.html">my</a> <span class="i">$property_hash</span> = read_properties_multival_var <span class="i">$filename</span><span class="cm">,</span> <span class="i">$string</span><span class="sc">;</span>
164
<a class="l_k" href="../functions/my.html">my</a> <span class="i">$property_hash</span> = read_properties_multival_var <span class="i">$filename</span><span class="cm">,</span> <span class="i">$string</span><span class="cm">,</span> <span class="i">$notLC</span><span class="sc">;</span></pre>
165
<p>Parses the multiline text $string and returns a ref to a hash of its
166
fields, with each value being a ref to a list of values for that
167
field. See the description of read_properties_multival_lines for more
168
information. The string $filename is used in parsing-error messages
169
but the file is not accessed.</p>
171
<li><a name="read_properties_multival_lines"></a><b>read_properties_multival_lines</b>
172
<pre class="verbatim"> <a class="l_k" href="../functions/my.html">my</a> <span class="i">$property_hash</span> = read_properties_multival_lines <span class="i">$filename</span><span class="cm">,</span> <span class="i">$notLC</span><span class="cm">,</span> <span class="i">@lines</span><span class="sc">;</span></pre>
173
<p>This is function is not exported. You should use read_properties_var,
174
read_properties, read_properties_multival, or read_properties_multival_var
176
<p>Parses the list of text strings @lines and returns a ref to a hash of
177
its fields, with each value being a ref to a list of values for that
178
field. The string $filename is used in parsing-error messages but the
179
file is not accessed.</p>
180
<p>The function is similar to read_properties_lines, with the following
182
<pre class="verbatim"> Multiline values are can only be given in RFC-822 style notation,
183
not with heredoc.</pre><pre class="verbatim"> No sanity-checking is performed. Lines that could not be parsed are
184
silently ignored.</pre>
185
<pre class="verbatim"> Multiple occurances of a field are allowed.</pre>
186
<pre class="verbatim"> Each hash value is a <a class="l_k" href="../functions/ref.html">ref</a> to a list of key <a class="l_k" href="../functions/values.html">values</a> instead of a simple
187
value string. The list is in the order the <a class="l_k" href="../functions/values.html">values</a> appear in <span class="i">@lines</span>.</pre>
189
<li><a name="execute"></a><b>execute</b>
190
<pre class="verbatim"> <a class="l_k" href="../functions/my.html">my</a> <span class="i">$retval</span> = execute <span class="i">$cmd</span><span class="sc">;</span>
191
<a class="l_k" href="../functions/my.html">my</a> <span class="i">$retval</span> = execute <span class="i">$cmd</span><span class="cm">,</span> <span class="i">$quiet</span><span class="sc">;</span></pre>
192
<p>Executes $cmd as a single string via a perl system() call and returns
193
the exit code from it. The command is printed on STDOUT before being
194
executed. If $cmd begins with a # (preceeded optionally by whitespace)
195
it is treated as a comment and is not executed. If $quiet is false (or
196
not given) and the command failed, a message including the return code
197
is sent to STDOUT.</p>
199
<li><a name="execute_script"></a><b>execute_script</b>
200
<pre class="verbatim"> <a class="l_k" href="../functions/my.html">my</a> <span class="i">$retval</span> = execute_script <span class="i">$script</span><span class="sc">;</span>
201
<a class="l_k" href="../functions/my.html">my</a> <span class="i">$retval</span> = execute_script <span class="i">$script</span><span class="cm">,</span> <span class="i">$quiet</span><span class="sc">;</span></pre>
202
<p>Executes the multiline script $script.</p>
203
<p>If $script appears to specify an interpretter (i.e., the first line
204
begins with #!) the whole thing is stored in a temp file which is made
205
chmod +x and executed. If the tempfile could not be created, the
206
program dies with an error message. If executing the script fails, the
207
tempfile is not deleted and the failure code is returned.</p>
208
<p>If $script does not specify an interpretter, each line is executed
209
individually. In this latter case, the first line that fails causes
210
further lines to not be executed and the failure code is returned.</p>
211
<p>In either case, execution is performed by Fink::Services::execute
212
(which see for more information, including the meaning of $quiet).</p>
214
<li><a name="expand_percent"></a><b>expand_percent</b>
215
<pre class="verbatim"> <a class="l_k" href="../functions/my.html">my</a> <span class="i">$string</span> = expand_percent <span class="i">$template</span><span class="sc">;</span>
216
<a class="l_k" href="../functions/my.html">my</a> <span class="i">$string</span> = expand_percent <span class="i">$template</span><span class="cm">,</span> \<span class="i">%map</span><span class="sc">;</span>
217
<a class="l_k" href="../functions/my.html">my</a> <span class="i">$string</span> = expand_percent <span class="i">$template</span><span class="cm">,</span> \<span class="i">%map</span><span class="cm">,</span> <span class="i">$err_info</span><span class="sc">;</span></pre>
218
<p>Performs percent-expansion on the given multiline $template according
219
to %map (if one is defined). If a line in $template begins with #
220
(possibly preceeded with whitespace) it is treated as a comment and no
221
expansion is performed on that line.</p>
222
<p>The %map is a hash where the keys are the strings to be replaced (not
223
including the percent char). The mapping can be recursive (i.e., a
224
value that itself has a percent char), and multiple substitution
225
passes are made to deal with this situation. Recursing is currently
226
limitted to a single additional level (only (up to) two passes are
227
made). If there are still % chars left after the recursion, that means
228
$template needs more passes (beyond the recursion limit) or there are
229
% patterns in $template that are not in %map. If either of these two
230
cases occurs, the program will die with an error message. If given,
231
$err_info will be appended to this error message.</p>
232
<p>To get an actual percent char in the string, protect it as %% in
233
$template (similar to printf()). This occurs whether or not there is a
234
%map. This behavior is implemented internally in the function, so you
235
should not have ('%'=>'%') in %map. Pecent-delimited percent chars are
236
left-associative (again as in printf()).</p>
237
<p>Expansion keys are not limitted to single letters, however, having one
238
expansion key that is the beginning of a longer one (d and dir) will
239
cause unpredictable results (i.e., "a" and "arch" is bad but "c" and
241
<p>Curly-braces can be used to explicitly delimit a key. If both %f and
242
%foo exist, one should use %{foo} and %{f} to avoid ambiguity.</p>
244
<li><a name="filename"></a><b>filename</b>
245
<pre class="verbatim"> <a class="l_k" href="../functions/my.html">my</a> <span class="i">$file</span> = filename <span class="i">$source_field</span><span class="sc">;</span></pre>
246
<p>Treats $source_field as a URL or "mirror:" construct as might be found
247
in Source: fields of a .info file and returns just the filename (skips
248
URL proto/host or mirror-type, and directory hierarchy). Note that the
249
presence of colons in the filename will break this function.</p>
251
<li><a name="version_cmp"></a><b>version_cmp</b>
252
<pre class="verbatim"> <a class="l_k" href="../functions/my.html">my</a> <span class="i">$bool</span> = version_cmp <span class="i">$fullversion1</span><span class="cm">,</span> <span class="i">$op</span><span class="cm">,</span> <span class="i">$fullversion2</span><span class="sc">;</span></pre>
253
<p>Compares the two debian version strings $fullversion1 and
254
$fullversion2 according to the binary operator $op. Each version
255
string is of the form epoch:version-revision (though one or more of
256
these components may be omitted as usual--see the Debian Policy
257
Manual, section 5.6.11 "Version" for more information). The operators
258
are those used in the debian-package world: << and>> for
259
strictly-less-than and strictly-greater-than, <= and >= for
260
less-than-or-equal-to and greater-than-or-equal-to, and = for
262
<p>The results of the basic comparison (similar to the perl <=> and cmp
263
operators) are cached in a package variable so repeated queries about
264
the same two version strings does not require repeated parsing and
265
element-by-element comparison. The result is cached in both the order
266
the packages are given and the reverse, so these later requests can be
267
either direction.</p>
269
<li><a name="raw_version_cmp"></a><b>raw_version_cmp</b>
270
<pre class="verbatim"> <a class="l_k" href="../functions/my.html">my</a> <span class="i">$cmp</span> = raw_version_cmp <span class="i">$item1</span><span class="cm">,</span> <span class="i">$item2</span><span class="sc">;</span></pre>
271
<p>This is function is not exported. You should use version_cmp instead.</p>
272
<p>Compare $item1 and $item2 as debian epoch or version or revision
273
strings and return -1, 0, 1 as for the perl <=> or cmp operators.</p>
275
<li><a name="latest_version"></a><b>latest_version</b>
276
<pre class="verbatim"> <a class="l_k" href="../functions/my.html">my</a> <span class="i">$latest</span> = latest_version <span class="i">@versionstrings</span><span class="sc">;</span></pre>
277
<p>Given a list of one or more debian version strings, return the one
278
that is the highest. See the Debian Policy Manual, section 5.6.11
279
"Version" for more information.</p>
281
<li><a name="sort_versions-%7b"></a><b>sort_versions {</b>
282
<pre class="verbatim"> <a class="l_k" href="../functions/my.html">my</a> <span class="i">@sorted</span> = sort_versions <span class="i">@versionstrings</span><span class="sc">;</span></pre>
283
<p>Given a list of one or more debian version strings, return the list
284
sorted lowest-to-highest. See the Debian Policy Manual, section 5.6.11
285
"Version" for more information.</p>
287
<li><a name="parse_fullversion"></a><b>parse_fullversion</b>
288
<pre class="verbatim"> <a class="l_k" href="../functions/my.html">my</a> <span class="s">(</span><span class="i">$epoch</span><span class="cm">,</span> <span class="i">$version</span><span class="cm">,</span> <span class="i">$revision</span><span class="s">)</span> = parse_fullversion <span class="i">$versionstring</span><span class="sc">;</span></pre>
289
<p>Parses the given $versionstring of the form epoch:version-revision and
290
returns a list of the three components. Epoch and revision are each
291
optional and default to zero if absent. Epoch must contain only
292
numbers and revision must not contain any hyphens.</p>
293
<p>If there is an error parsing $versionstring, () is returned.</p>
295
<li><a name="collapse_space"></a><b>collapse_space</b>
296
<pre class="verbatim"> <a class="l_k" href="../functions/my.html">my</a> <span class="i">$pretty_text</span> = collapse_space <span class="i">$original_text</span><span class="sc">;</span></pre>
297
<p>Collapses whitespace inside a string. All whitespace sequences are
298
converted to a single space char. Newlines are removed.</p>
300
<li><a name="pkglist2lol"></a><b>pkglist2lol</b>
301
<pre class="verbatim"> <a class="l_k" href="../functions/my.html">my</a> <span class="i">$struct</span> = pkglist2lol <span class="i">$pkglist</span><span class="sc">;</span></pre>
302
<p>Takes a string representing a pkglist field and returns a ref to a
303
list of lists of strings representing each pkg. The elements of the
304
list referenced by $struct are joined by logical AND (commas in
305
$pkglist). The pkgs in each list referenced by an element of @$srtuct
306
are joined by logical OR (delimited by vertical-bar within a comma-
307
delimited cluster). Leading and trailing whitespace are removed from
308
each pkg, and null pkgs are removed. A ref to an array is always
309
returned, though it may contain no elements. Each element of @$struct
310
is always an array ref, even if that list only has one element; none
311
of these will have no elements. A new $struct is returned on each
312
call, so changing one returned value does not afect the data returned
313
by another call or the underlying data.</p>
315
<li><a name="lol2pkglist"></a><b>lol2pkglist</b>
316
<pre class="verbatim"> <a class="l_k" href="../functions/my.html">my</a> <span class="i">$pkglist</span> = lol2pkglist <span class="i">$struct</span><span class="sc">;</span></pre>
317
<p>Given a ref to a list of lists of pkgs, reconstitute the Debian
318
pkglist string. Blank/whitespace-only/undef elements are removed. The
319
return is always defined (though it may be null). $struct is not
322
<li><a name="file_MD5_checksum"></a><b>file_MD5_checksum</b>
323
<pre class="verbatim"> <a class="l_k" href="../functions/my.html">my</a> <span class="i">$md5</span> = file_MD5_checksum <span class="i">$filename</span><span class="sc">;</span></pre>
324
<p>Returns the MD5 checksum of the given $filename. Uses /sbin/md5 if it
325
is available, otherwise uses the first md5sum in PATH. The output of
326
the chosen command is read via an open() pipe and matched against the
327
appropriate regexp. If the command returns failure or its output was
328
not in the expected format, the program dies with an error message.</p>
330
<li><a name="get_arch"></a><b>get_arch</b>
331
<pre class="verbatim"> <a class="l_k" href="../functions/my.html">my</a> <span class="i">$arch</span> = get_arch<span class="sc">;</span></pre>
332
<p>Returns the architecture string to be used on this platform. For
333
example, "powerpc" for ppc.</p>
335
<li><a name="enforce_gcc"></a><b>enforce_gcc</b>
336
<pre class="verbatim"> <a class="l_k" href="../functions/my.html">my</a> <span class="i">$gcc</span> = <span class="i">enforce_gcc</span><span class="s">(</span><span class="i">$message</span><span class="s">)</span><span class="sc">;</span>
337
<a class="l_k" href="../functions/my.html">my</a> <span class="i">$gcc</span> = <span class="i">enforce_gcc</span><span class="s">(</span><span class="i">$message</span><span class="cm">,</span> <span class="i">$gcc_abi</span><span class="s">)</span><span class="sc">;</span></pre>
338
<p>Check to see if the gcc version optionally supplied in $gcc_abi is the
339
same as the default GCC ABI for the installed version of Mac OS X or Darwin.
340
If it is not, we return the value for the deafult GCC ABI.</p>
341
<p>If it is, or if $gcc_abi is not supplied, then we check to see if the
342
gcc version obtained from /usr/sbin/gcc_select agrees with the expected
343
(default) gcc version corresponding to the installed version of
344
Mac OS X or Darwin. If the versions agree, the common value is returned.
345
If they do not agree, we print $message and exit fink.</p>
346
<p>The strings CURRENT_SYSTEM, INSTALLED_GCC, EXPECTED_GCC, and
347
GCC_SELECT_COMMAND within $message are converted to appropriate values.</p>
348
<p>Sample message:</p>
349
<p>This package must be compiled with GCC EXPECTED_GCC, but you currently have
350
GCC INSTALLED_GCC selected. To correct this problem, run the command:</p>
351
<pre class="verbatim"> sudo gcc_select GCC_SELECT_COMMAND</pre>
352
<p>(You may need to install a more recent version of the Developer Tools to be
355
<li><a name="get_sw_vers"></a><b>get_sw_vers</b>
356
<pre class="verbatim"> <a class="l_k" href="../functions/my.html">my</a> <span class="i">$os_x_version</span> = get_sw_vers<span class="sc">;</span></pre>
357
<p>Returns OS X version (if that's what this platform appears to be, as
358
indicated by being able to run /usr/bin/sw_vers). The output of that
359
command is parsed and cached in a global configuration option in the
360
Fink::Config package so that multiple calls to this function do not
361
result in repeated spawning of sw_vers processes.</p>
363
<li><a name="get_system_perl_version"></a><b>get_system_perl_version</b>
364
<pre class="verbatim"> <a class="l_k" href="../functions/my.html">my</a> <span class="i">$perlversion</span> = get_system_perl_version<span class="sc">;</span></pre>
365
<p>Returns the version of perl in that is /usr/bin/perl by running a
366
program with it to return its $^V variable. The value is cached, so
367
multiple calls to this function do not result in repeated spawning of
370
<li><a name="get_path"></a><b>get_path</b>
371
<pre class="verbatim"> <a class="l_k" href="../functions/my.html">my</a> <span class="i">$path_to_file</span> = get_path <span class="i">$filename</span><span class="sc">;</span></pre>
372
<p>Returns the full pathname of the first executable occurance of
373
$filename in PATH. The correct platform-dependent pathname separator
374
is used. This is an all-perl routine that emulates 'which' in csh.</p>
376
<li><a name="count_files"></a><b>count_files</b>
377
<pre class="verbatim"> <a class="l_k" href="../functions/my.html">my</a> <span class="i">$number_of_files</span> = <span class="i">&count_files</span><span class="s">(</span><span class="i">$path</span><span class="cm">,</span> <span class="i">$regexp</span><span class="s">)</span><span class="sc">;</span></pre>
378
<p>Returns the number of files in $path. If $regexp is set only
379
files matching the regexp are returned.</p>
381
<li><a name="eval_conditional"></a><b>eval_conditional</b>
382
<pre class="verbatim"> <a class="l_k" href="../functions/my.html">my</a> <span class="i">$bool</span> = <span class="i">&eval_conditional</span><span class="s">(</span><span class="i">$expr</span><span class="cm">,</span> <span class="i">$where</span><span class="s">)</span><span class="sc">;</span></pre>
383
<p>Evaluates the logical expression passed as a string in $expr and
384
returns its logical value. If there is a parsing error, abort and
385
print a message (including $where) is printed. Two syntaxes are
387
<p>Leading and trailing whitespace is ignored. The strings themselves cannot
388
contain whitespace or any of the op operators (no quoting, delimiting,
389
or protection syntax is implemented).</p>
393
<div id="contentFooter"><a href="http://www.perl.org"><img src="../perlpowered.png" border=0></a></div>
398
<div id="rightContent">
400
<a href="#" onClick="closeRight()" title="Hide toolbar" onmouseover="rightCloseIcon.src='../close_purple.gif';" onmouseout="rightCloseIcon.src='../close_blue.gif';"><img src="../close_blue.gif" name="rightCloseIcon" id="rightCloseIcon" border=0></a>
404
<form action="../search.html" name="perldoc_search">
405
<input type="text" name="q" size="10" class="grey"><br>
406
<!--<select name="r"><option value="1" selected>Go to top result<option value="0">Show results list</select>-->
411
<a href="#" onClick="addLabel('Fink::Services','Fink/Services.html')">Add this page</a>
413
<div class="labels" id="labels">