Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
re-stating your flawed position over again
"=~ is more volatile than eq/ne" is flawed?


I invited corrections, none were forthcoming.
Yeah, sorry, i admit i didn't bother to read every single thing before my first post because stuff is very wordy. Here's your problem:

use Exception::Class <stuff_here>; does two things: First, it instantiates all the classes you ask for. In this case MyException being one of them. Optionally you can also ask it to export shortcut subs into the module where you use it. In your case you only ask it to export throw_fields.

To fix your example, change the two "MyExceptions" in sub divide to "MyException", so you're actually trying to throw with the class of an exception (by your use of caught, this is presumably the right option).
D:\Exception-Class-OnCaller>perl bluh.pl 1 0 The second argument must not be zero at bluh.pl line 38.

And the things you changed mean that you're not using half of the functionality of the module. ... E::C throw() and caught()
These are merely convenience functions, clocking in at 15 of 415 code lines (without docs). That is 3.6%. The rest and the majority of the code deals exclusively with the creation of exception objects.

The only reason i did not use them is because i personally do not like them and think T::T looks nicer. Your assumption that i could not get them to work is not correct as my fix to your example above proves.

"Ex->throw" is literally just a shortcut for "die $ex || Ex->new". This has nothing to do with T::T's try, since THAT function does much more stable wrapping of code and does nothing to create exception objects, but only stores them if the wrapped code emits them.

"caught" is only there so you can inspect the errors from the eval and compare them to certain targets in one line. It has only superficial resemblance to try's catch, which is aimed at security and stability and does not have the convenience of actually inspecting the exceptions.

The intent of Exception::Class is merely to provide exception objects, not to provide exception handling. These are two very different domains.

Let's just accept that you think I'm an idiot
I don't. At this moment i am of the belief that your hate of another language(*) does not allow you to evaluate things in a complete and rational manner. If i had good memory i would insert a jedi quote here.

(*) And on inspection of your the post with your example, also your hate of one specific person.

In reply to Re^16: eval to replace die? by mithaldu
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 wandering the Monastery: (14)
    As of 2014-08-28 16:17 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The best computer themed movie is:











      Results (264 votes), past polls