Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Generally, yes, given an operation that might fail, you'd like to catch and die on all errors. But there are cases where you maybe want to see if there's failure, but do nothing about it if there is. For example, in the generation of the perlmonk maps, I query a remote server for the cloud images. If the server doesn't respond, I simply ignore it and go on since the maps can be generated without it. On the other hand, if the user list from PM isn't available, then making the maps would be pointless, and I'd want to die there. EG:
$clouds = get_clouds( $server ); # note no die if ( $clouds ) { $options{ clouds } = $clouds; } $users = get_users( $server ) or die "Cannot connect to user list" if ( $users ) { $options{ users } = $users; } #not neccesary but nice +ly parallel

So, IMO, it's nearly always better to explicitly state the die condition than to group them into one. While 90% of the time you may not have to worry about special cases, if you find the need to , you'll have to do a lot of code modification in order to get the special case to work.

-----------------------------------------------------
Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
"I can see my house from here!"
It's not what you know, but knowing how to find it if you don't know that's important


In reply to Re: use Fatal; by Masem
in thread use Fatal; by cLive ;-)

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!
  • 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
  • Outside of code tags, you may need to use entities for some characters:
            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 making s'mores by the fire in the courtyard of the Monastery: (6)
    As of 2014-07-31 08:43 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (247 votes), past polls