Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
That is a very ugly use of eval, IMHO.

I've nothing wrong with the eval function, but I'm of the opinion that eval should be used for code that might be generated on the fly (most likely from user input), thus implying the dynamic nature of the perl language. Using eval to evaluate code that is already hard written into the code, on the other hand, seems to be a way to get around compiler/strict or other issues. Certainly there are cases where using eval on hard-coded code is necessary to achieve certain results (for example, if you have a function from a module that would die on failure, but you want to catch this), but otherwise, it reminds me of when I saw C or C++ code that was wrapped in pragmas in order to disable certain compiler features to get their badly written code working properly.

IMO, and I think it will be easier in perl 6, I'd much rather move to an OO-based Exception model as Java has, as it forces you to deal with errors, instead of allowing them to slip. This way, you can deal with errors that might be generated from one part of the code differently than errors from other parts. It does require you to think about these errors from the start, but it ends up improving your overall error-catching of the final program.

Dr. Michael K. Neylon - || "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: Re: Re: use Fatal; by Masem
in thread use Fatal; by cLive ;-)

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?

    What's my password?
    Create A New User
    and the monks are chillaxin'...

    How do I use this? | Other CB clients
    Other Users?
    Others drinking their drinks and smoking their pipes about the Monastery: (4)
    As of 2018-02-24 07:11 GMT
    Find Nodes?
      Voting Booth?
      When it is dark outside I am happiest to see ...

      Results (310 votes). Check out past polls.