... &&= too techy ...
A bit too techy and, for these old eyes, just plain difficult to see! I think I'd incline toward something like (all untested)
sub fred {
my ($t, $u, $v, $w, $x, $y) = @_;
somelogger(5, "fred", "start of fred");
my $ok = 1;
$ok = method1($t) if $ok;
$ok = method2($u) if $ok;
my $pid = open my $ph, "/somewhere/program $v |";
my $output = '';
$ok = method3(<$ph>, \$output) if $ok;
close $ph;
waitpid $ph,0;
if ($ok) {
somelogger(5, "fred", "fred completed successfully");
}
else {
somelogger(5, "fred", "error during fred");
}
return $ok;
}
or maybe even (assuming the methods can be made to return error strings or the empty string for no error)
sub fred {
my ($t, $u, $v, $w, $x, $y) = @_;
somelogger(5, "fred", "start of fred");
my $err;
$err = method1($t) unless $err;
$err = method2($u) unless $err;
my $pid = open my $ph, "/somewhere/program $v |";
my $output = '';
$err = method3(<$ph>, \$output) unless $err;
close $ph;
waitpid $ph,0;
if ($err) {
somelogger(5, "fred", "error '$err' during fred");
}
else {
somelogger(5, "fred", "fred completed successfully");
}
return $err;
}
Give a man a fish: <%-(-(-(-<
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.