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

use Perl Log In

Log In

[ Create a new account ]

grantm (164)

  (email not shown publicly)

Just a simple [] guy, hacking Perl for fun and profit since way back in the last millenium. You may find me hanging around in the monestary [].

What am I working on right now? Probably the Sprog project [].

GnuPG key Fingerprint:
6CA8 2022 5006 70E9 2D66
AE3F 1AF1 A20A 4CC0 0851

Journal of grantm (164)

Thursday June 03, 2010
04:08 PM

BCVI 3.0 Hits CPAN

My big news today is that Version 3.0 of bcvi is now available on CPAN. If you have no idea what bcvi is then you'll be pleased to know I've written this article to answer all your questions - it even has pictures!

Way back in 2007 I knocked up a proof-of-concept implementation of a somewhat crazy idea. I used it for a while and found it useful so I shared it on PerlMonks to see if other people found it useful too. That was version 1.0.

Over time I fleshed out the core to make something more robust, more secure and more useful. But I never released it publically because it always seemed like the sort of tool that would be most useful to a person who hacked it into a form that suited them. I really had no idea how to release and maintain a tool that was meant to be hacked. So I kept it to myself and continued to find it useful. That was version 2.0.

Eventually I realised that what I needed was a solid core of infrastructure code and a plugin API that would allow people to hack the core without editing the script itself. Quite why it took me so long to realise this, I couldn't say. After all it's exactly what I did with SSHMenu and that has worked out very well.

The problem was that I didn't have a solid core of infrastructure code. What I had was a proof-of-concept script that had some of the rough edges knocked off and some new shiny bits bolted on. So earlier this year I set about rewriting bcvi in a more extensible way. Then to prove the new plugin API, I wrote a few simple plugins. Now it seems to be in a stable enough form for me to call it version 3.0.

And so it's released. There's even some documentation for the plugin API. It'll be interesting to what, if anything, people make of it.

Cross posted from my blog.

Wednesday September 16, 2009
04:21 AM

Another reason to switch to Git

If your project was in Git then you could use Gource to visualise the commit history.

Gource is written by Andrew Caudwell - a colleague and sometime Wellington Perl Monger. He loves playing with graphics and interesting visualisations. If you're running Ubuntu/Debian you can even grab a .deb from the project 'Downloads' page, install it, cd into your git project and run gource - then sick back and what history.

Friday March 20, 2009
08:47 PM

The 'Faces' of Wellington Perl Mongers

Wellington Perl Mongers had a fun evening last week - our annual Lightning Talk meeting. As usual the talk schedule was looking pretty thin in the days leading up to the event but with a bit of encouragement people did step up and the evening went well. The talks covered a range of Perl modules; a bit on Erlang and CouchDB (thanks Lenz); mountain biking and mapping (Donovan); and Perl on the iPhone (Tobi). We even got to see the beginnings of Matt's robot army (doesn't look like we have anything to fear yet) and Srdjan gave us his sermon entitled "If statements considered harmful". I asked Matt to take some photos. The lighting wasn't great so not many came out but here's a montage.

As a group, it's clear that there's one key thing we can all do to improve our delivery - turn and face the audience. The one exception pictured is the guy speaking without slides.

Cross-posted from my blog

Saturday February 07, 2009
05:18 AM

Special Guests at this Tuesday

This Tuesday evening (Feb 10th) Wellington Perl Mongers are very pleased to welcome Jacinta Richardson and Paul Fenwick from Perl Training Australia. They're over here on vacation (as well as for Baa Camp) and have kindly offered to come along and speak at our February meeting.

As usual, the meeting will be hosted by Catalyst IT (150 Willis Street) and the start time is 6:00pm - bring a friend.

Saturday January 31, 2009
02:42 AM

Remember Your Responsibilities

A colleague encountered an odd problem the other day. It took us a while to realise what was going on, you'll probably work it out much quicker ...

Here's a simplified version of what we were dealing with:

    use strict;
    use warnings;

    eval {
        my $obj = SomeClass->new();
        die "Code Red!\n";

    if($@) {
        print "Exception caught: $@\n";
    else {
        print "No exception occurred\n"

We both expected it to output:

    Exception caught: Code Red!

but instead we got:

    No exception occurred

You probably worked it out straightaway but for the record, here's what was happening ...

The die statement did generate an exception and the message was stored in $@. Of course the code in the eval block stopped executing immediately but when control flow exited the block, any lexcial variables declared in the block went out of scope. In this case there was only one: $obj. What we didn't realise is that $obj's class defined a destructor method ('DESTROY'). This method is called when the object goes out of scope and apparently in our case the method wrapped something in an eval. Whatever that something was, it completed without generating an exception, so $@ ended up empty - indicating no error and overwriting the exception message that our code put there.

So, if you write a destructor method and it needs to use eval, please remember to use local($@) to restore the previous value of $@ when your routine completes.

Cross-posted from my shiny new blog

Thursday December 04, 2008
05:35 PM

OSDC 2008 Sydney

I'm visiting Australia for OSDC2008 in Sydney. It's been a pretty good conference so far and there are a few interesting talks lined up today before I jump onto a plane back to New Zealand this afternoon.

Wednesday kicked off with a fun talk from Chris Dibona which was essentially a bunch of interesting anecdotes from Google. Then I went along to see Michael Neale talk about rule based systems. It seems like a technology that should be highly applicable to my current client - but only if we rewrite their system from the ground up :-(. I'll have to think about how we could start to take advantage of this stuff in a smaller steps.

I was also fascinated by Clifford Heath's talk on semantic modelling. He presented well and clearly has put a lot of work into it. The talk followed a bottom-up sort of approach to introduce concepts that built on each other. It probably would have benefitted from a top-down bit as well. That would have given the audience more of an idea of where the talk was heading and given them a framework to hang the lower-level concepts onto.

My first talk was Wednesday afternoon and looked at the theory and practice of Test Driven Development. Unfortunately the accompanying paper was accidentally omitted from the printed conference proceedings but you can download it from my web site. I think I managed to avoid embarassing gaffes and the talk seemed to be well received.

Jacinta was up next with a good round up of Perl MVC frameworks. David Fetter did a good talk on DBI-Link in Postgres 8.4 but since we have yet to get our client up to 8.3, I think I'll defer getting too excited about that one. The lightning talks and the conference dinner went well and Anthony Baxter's dinner talk was highly entertaining.

Thursday was a quieter day for me. There weren't a lot of talks that appealed to me and a couple that I did go to were disappointing. Of course some of that may be my own fault - my head was a bit fuzzy from a late night and lots of beer. Jonathan Oxer had a couple of good talks that led me to doubt his sanity but they were very entertaining. After the lightning talks the Sydney Perl Mongers organised an outing for more beer and food on Thursday night. That was great - thanks guys.

My second talk is later today and I've got to dash off early this afternoon to catch a flight back to Wellington. Looking forward to a few of today's talks.

Tuesday November 11, 2008
03:31 AM

Problem solvers

If you're a problem solver you'll probably enjoy the "Fantastic Contraption" game which allows you to make cool machines like this.
Sunday August 24, 2008
07:16 PM

Chinese tech

Following news that chinese scientists have completed a face transplant, I commented that next time China hosts the Olympics they'll be able to have a six year old singer with a good voice and a pretty face. A colleague immediately came back with "Well they'll claim she's six".

Thursday August 14, 2008
05:59 AM August Meeting

We had the August meeting of this week. Sam gave us his talk on the work he did converting the Perl source code history to git. It turned out to be a rather larger undertaking than he originally imagined. Sam was preparing this talk for YAPC::Eu but unfortunately the costs of getting there have proved prohibitive so he may just have to recast the talk as a chapter in his memoirs.

Next up, Brenda gave us a quick rundown on opportunities for networking with (open source) geeks in Wellington. In a novel twist, her presentation slides were a flickr photo set.

After Brenda's talk we had a lively discussion on strategies for dealing with an inherited codebase; code formatting styles; Perl best practices; the evils of misused subroutine prototypes; and interesting home grown config file formats.

To round off the evening, I gave a 'behind the scenes' talk on last month's HackOff competition. The focus for people on the night (and after the event) has been on decoding the datafiles for each of the problems. The focus of the talk was on how I went about encoding the data to produce the question files. There is strong interest in doing it again next year which means more work for me - but at least I had fun.

Tuesday August 05, 2008
06:06 AM

Perl 5.6.2 hates me

I was feeling virtuous for having finally made the time to address the RT queue for XML::SAX. After resolving 7 tickets I pushed out a new release and within about an hour I'd learned from the CPAN testers that the new release doesn't work with 5.6 (yay for CPAN testers!). The thing that's puzzling me is that I can't see how it ever worked.

Having compiled up a 'fresh' copy of Perl v5.6.2, I'm now able to see what the CPAN Testers are seeing. Here's a minimal test case:

$ perl -le 'q{TEST} =~/^[\x{0041}-\x{005A}]+$/ && print q{OK}'
Invalid [] range "}-\x" before HERE mark in regex m/^[\x{0041}-\x << HERE {005A}]+$/

The same thing works as expected on 5.8. The XML::SAX::PurePerl parser makes extensive use of this syntax (character classes which include ranges of unicode characters) to match productions such as these from the XML spec. It's been that way since 2002 and apparently working (modulo a few bugs). Indeed if I go back to the code in the previous release it passes all the tests - even with regexes that look like that.

I'm going to bed and hoping this makes more sense in the morning.