Talks

Matts on 2002-07-31T11:17:21

All my OSCon talks are now online.

Please let me know if any of them don't work - I had mixed experiences with them loading in browsers, but it always seemed to work if I used lwp-download/wget/curl and loaded locally.

Also for non-attendees I'd love to get feedback on the content.


Spamassassin way cool

Dom2 on 2002-07-31T13:01:33

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...

-Dom

Thank you!

jdavidb on 2002-07-31T13:35:33

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.

setting up $SIG{__DIE__}

2shortplanks on 2002-07-31T14:18:34

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...

Re:setting up $SIG{__DIE__}

Matts on 2002-07-31T14:30:21

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.

Re:setting up $SIG{__DIE__}

2shortplanks on 2002-07-31T14:52:38

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 start doing this for things like TT and AxKit? For mod_perl? You have to start the ball rolling somewhere

Re:setting up $SIG{__DIE__}

Matts on 2002-07-31T15:17:10

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 ;-)

Re:setting up $SIG{__DIE__}

darobin on 2002-07-31T15:22:35

I third that. Imho Exception.pm (or ExceptionInterface.pm) 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?