I keep completing things that I've been meaning to do for ages and then realising they weren't on my to-do list. That's my excuse for why my to-do list never gets any shorter, anyhow.
I got another mail from Jonathan Swartz asking about the use of
Class::Delegation with CGI::Wiki - apparently
Class::Delegation doesn't play too nicely with mod_perl
. I'd
been meaning for ages to get rid of this dependency, and Jon's mail
reminded me to get around to it.
I was very pleased when Richard first pointed me at Class::Delegation, because it seemed a very nice way to avoid having to write
sub method1 { my $self = shift; $self->attribute1->method1( @_ ); } sub method2 { my $self = shift; $self->attribute2->method2( @_ ); }
etc etc. (I'm not allowed to do that sort of thing in AUTOLOAD
because it makes Richard turn funny colours.)
It started getting on my nerves reasonably quickly though, because it
eats your attributes' methods' error messages and replaces them with
"Could not delegate <method>
". This is not very useful. No, I
never found time to look into it and find out if I could stop it doing
that. Bad programmer.
While I was taking it out, I found some slightly dodgy assumptions in some parts of the code that had previously been obscured by Class::Delegation papering over cracks. Lessons here:
1) Tests are wonderful. Tests are really wonderful. The CGI::Wiki tests are well worth the (maybe slightly excessive) length of time they take to run.
2) Sometimes nice syntactic sugar can make what's really going on less clear.