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.
  • I've been meaning to look at spamassassin for ages, and your talk was just what I needed to get around to it. Damn, it's simple! One portinstall command later, I was happily deleteing my daily dose of claptrap.

    Also, I found the exceptions talk very valuable and will be passing it around here...


  • Matt, thanks for these slides! I can't follow everything, but I've learned a lot in the last few minutes of skimming and just added several things to my list of things to check out. Wish I could have made it to OSCON.

    J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
  • 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 was trying to get Template Toolkit running under AxKit? Well, TT does the right thing (TM) by throwing all errors as exception objects....however they're not "MyException" objects. So what ends up happening is that the Template::Exception objects get turned into MyException::Default objects....which the exception system within TT doesn't recognise...and madness ensues.

    As you saw in the source, I had to resort to localising $SIG{__DIE__} myself...which works, but shouldn't be what I have to do...

    • 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 brok
      • 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 []