Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
The value of the change (positive/negative) determined the direction of the change and based on that a css style which is used to colour the message.

First observation, if the only purpose of the parsing is to detect positive or negative--the regex was wrong. A simple $message =~ /-/ would probably suffice, and create parity with your exception solution in as much as you could change the datatype of the value without requiring a change in the exception handling mechanism.

Not that I would advocate that solution, but it demonstrates the contrivance of your example. It conflates two exceptions as one.

The correct solution for the problem of two different possible errors, is to raise the appropriate of two exceptions. One for less; one for more. Each with a different error number. Then there is no purpose in parsing the error; a simple compare takes the appropriate action.

I would like to ask you to look at the original starting post

Out of courtesy, I looked again. And I reached the same conclusions.

Nothing in the OP requires, nor would benefit from, a structured exception. What corrective action could be taken to correct a failure to retrieve a file? None!

The only possible action is to report the error and terminate. Whether it be that the file does not exist;, or has the wrong permission; there is no point in trapping the die, when the only reasonable action is to do exactly what die does. And all to satisfy the scurrilous default from perl-critic.

Recommending moving to using E::C, in order to silence perl-critic, when the only possible action is to (laboriously) emulate exactly what die does, is ...

(*)Did you do me the courtesy re-reading each evolution of my posts, within the context of the posts to which I replied? (Betting not!)


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^23: eval to replace die? by BrowserUk
in thread eval to replace die? by hsmyers

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 taking refuge in the Monastery: (6)
    As of 2014-12-25 09:04 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (159 votes), past polls