Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
... &&= 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:  <%-(-(-(-<


In reply to Re^2: Number of times I've used goto in Perl by AnomalousMonk
in thread Number of times I've used goto in Perl by vroom

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (5)
    As of 2019-10-14 10:21 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Notices?