I'm developing a house-keeping program much like logrotate, but with some extension specifically modeled to our company. Since I want this thing to have as-readable-as-possible code I'm trying to go OOP all the way. And the proper way to do errors in OOP are exceptions (for all I know). Now, I know about Error, Exception::Class, and why $@ is unreliable.

But here's the crux of the thing: none of the servers really has any modules besides the core of 5.8.8, as packaged by ActiveState; none of the servers is allowed access to the Internet at all, so there's no CPAN; and finally, all third party software installs have to be approved and packaged for all possible systems.

So my question is: is there any other way for an half-way decent exception handling besides the fugly eval { ... }; if ( $@ ) { ... } or importing Error via the "smuggling bay" by making it part of my package?


In reply to Objects and Exceptions sans CPAN by Da_Lu

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, details, 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, summary, 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.