Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Hmm, I have a hard time agreeing with you on this one, or at least your implementation.

    'scuse the cut and paste:

    local $SIG{__DIE__} = sub {
      my $err = shift;
      if ($err->isa('MyException')) {
        die $err; # re-throw
      else {
        # Otherwise construct a MyException with $err as a string
        die MyException::Default->new($err);

    This (which is basically what AxKit does) drives me nuts. Remember a couple of weeks ago when I

    • Well this whole thing is a real bitch, and cross platform exception objects is completely unsolved in Perl. I mean really everything should derive from a single Exception type, but nobody had the forethought to do that. I think this is a real problem with the perl community - almost too much desire to allow TMTOWTDI.

      Alternatively you could change the above to use blessed() from Scalar::Util, but that means my exception handler can't know what types to expect, and that's bad too. So my "solution" isn't broken, I think Perl is ;-) Things like Time::Piece prove that you can build a backwards-compatible object system, and I really think maybe Perl should look into doing that somehow for exceptions. However as you've shown, pretty much any solution you can come up with is going to cause problems.
      • I mean really everything should derive from a single Exception type, but nobody had the forethought to do that.

        Okay, well maybe we should do something about it then. As I understand it all we need to do is decide on a common 'marker' class name that all exception class implementations - no matter how complex or how simple - use and can declare themselves to be.

        Something like

          package My::CustomException;
          @ISA = qw( ExceptionInterface );

        For each of the class. Is this right? Could

        • We could all just use Exception::Class.

          Really something should be made core, and I think putting something into core is going to be impossible now "The Great Sponge" has gone ;-)
        • I third that. Imho (or only needs to be a package with an AUTOLOAD that does nothing to ensure that the package isn't empty (which Perl will complain about) and that any personal exception scheme can inherit from it without being constrained as to the interface that must be implemented. As all that's needed seems to be a common ancestor, perhaps it should be call UNIVERSAL::Exception, or UniversalException?


          -- Robin Berjon []