<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
A few minor things...<br>
<br>
I wouldn't use the goto to break out of a loop. You can use a loop
label to do that kind of thing:<br>
<br>
install_search: for my $dir (@dirs) {<br>
...<br>
if (defined $install_dir) {<br>
last install_search;<br>
}<br>
}<br>
<br>
I like wrapping the script print's in a function, thus,<br>
<br>
message("FFTW3 selected, but FFTW3_DIR not set. Checking some
places...");<br>
<br>
Multi-line strings can be used.<br>
<br>
The function "carp" is usually nicer than "die" because it gives you
a stack trace (see
<a class="moz-txt-link-freetext" href="http://search.cpan.org/dist/perl-5.8.8/lib/Carp.pm">http://search.cpan.org/dist/perl-5.8.8/lib/Carp.pm</a>).<br>
<br>
Cheers,<br>
Steve<br>
<br>
<div class="moz-cite-prefix">On 02/29/2016 01:35 PM, Erik Schnetter
wrote:<br>
</div>
<blockquote
cite="mid:CADKQjjfk6mYitU-gJwxQNRvADCQqS7ScEk5-bPuJY4mYHra--A@mail.gmail.com"
type="cite">
<pre wrap="">As discussed earlier today in the telecon, I rewrite the detection
(but not the build) script of the FFTW3 package in Perl. I attach the
Perl script for your consumption; otherwise, please look at the "perl"
branch of this thorn.
I am pleasantly surprised by the result. The Perl code was easier to
write than the Bash code. The resulting code is also cleaner and
easier to read. Support for arrays, scoped variables, and
differentiating between "empty string" and "undefined variable" help a
lot. Two 20-line Bash helper scripts turned into 2 lines of Perl each.
I also took the opportunity to add a few self checks.
There were only two minor hiccups, namely finding the equivalents of
"mkdir -p" and "date" in Perl. I solved both easily via Google
("make_path", "localtime" / "strftime").
Finally I want to remark that this script is still stand-alone.
Translating another script, comparing to Steve's MPI script, and
looking at Frank's bash_utils should easily identify common functions
that should be put into a module.
Steve -- could you as Perl expert do me a favour and scrutinize the
script for errors or ways to improve it?
-erik
</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@einsteintoolkit.org">Users@einsteintoolkit.org</a>
<a class="moz-txt-link-freetext" href="http://lists.einsteintoolkit.org/mailman/listinfo/users">http://lists.einsteintoolkit.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</body>
</html>