Lexical Attributes

A week or two ago, I took an idea from Aristotle about “shortcut” functions and made it into a little module: Attribute-Shortcut. Aristotle pointed out in the comments that the attributes should also work on coderefs as well as named subs. i.e.

  sub basename :Shortcut { s!.*/!! for @_ };
  my $basename = sub :Shortcut { s!.*/!! for @_ };

However, I can’t seem to find a way to make this work. Attribute::Handlers passes you the string “ANON” instead of a glob reference.

Looking deeper at the documentation for attributes, it seems to imply that attributes on lexical variables aren’t really very well supported anyway.

I think I may have to conclude that this isn’t going to work for now…


Log Rotation

I hate log rotation. It’s a pain to configure on my FreeBSD server. Just look at newsyslog.conf. That, and my experiences of the utter non-portability of log rotation programs between different Unixes have led me to believe that programs should probably handle their own log rotation. It just makes life easier having one less thing to integrate with the Operating System.

So, I’ve switched my Apache over to using cronolog in order to get date based logfiles automatically. I’ve used it on a project at work recently and it really works a treat.

I also noticed that PostgreSQL has grown the ability to take care of its own log files in recent versions. So I’ve switched that to doing date based logging with automatic rotation as well. Lovely.

All is not perfect of course. Oh no, that would be far too simple. There’s still the issue of removing old logfiles and/or compressing them. But that seems to be a smaller integration problem.

Of course the trigger for all this activity was finding a 220Mb access_log lying around. Doh!