Stories
Slash Boxes
Comments
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 ]

pjf (2464)

pjf
  (email not shown publicly)
http://pjf.id.au/
AOL IM: miyuki3k (Add Buddy, Send Message)
Jabber: pjf@jabber.org

I run Perl Training Australia [perltraining.com.au].

I help with Melbourne Perl Mongers.

I spend an awful lot of time talking about Perl, and have had my picture in the Australian newspapers with a camel. That's rather scary.

Journal of pjf (2464)

Sunday August 02, 2009
07:24 AM

Malayasia, London, Lisbon, oh my!

Malaysia, London, Lisbon, oh my!
If I seem slow to respond, distracted, or exhausted, here's why...

15-18th July
Portland, Oregon
19-24th July
San Jose, California (OSCON)
25-27th July
San Franscisco, California
28th July
On a plane above the Pacific (yes, the whole day!)
29-30th July
Home in Melbourne, Australia
31st July
Kuala Lumpur, Malayasia
1st August
London, England
2-5th August
Lisbon, Portugal (YAPC::EU)
6th August
Madrid, Spain
7-10th August
Dublin, Ireland
11th August
Edinburgh, Scotland
12-13th August
Darlington, England
14th August
Leeds and London, England
15-18th August
Kuala Lumpur, Malaysia

Yes, that's a whole month of solid travel, averaging only about 2.3 days in any one place at a time. If you wish to track my trips (eg, to see if I happen to arrive in your part of the world), or if you're curious, you can do so via dopplr.

Right now I'm in Lisbon. I'm exhausted, and have talks to prepare for YAPC::EU. However I suspect a bath and a snooze is going to trump talk preparation for once.

Wednesday July 29, 2009
07:31 PM

OSCON 2010 adventures

OSCON 2009 adventures
I think that I've found a new term to describe myself. Adventuretarian. I live off adventure.

OSCON
This was my second year at OSCON, and my first visit to San Jose. Unlike last year, where I was a self-described OSCON rockstar, this year I was happy to take a more relaxed approach. I wasn't giving as many talks, the talks I gave were all quite technical, and I didn't keynote. However, that doesn't mean I didn't have fun; far from it!

This OSCON I played around a bit with outfits. I'd picked up a pirate hat earlier in Portland, and used it in my tutorial when talking about PAR, the Perl Archiver. The hat ended up being one of my best fashion decisions ever, as it found its way into photo shoots, restaurants, and social events. In terms of getting noticed, or being popular with small children, or having random people say "Arrrr..." as they walk past, a pirate's hat is awesome.

My other outfit was my Star Trek uniform, used for my talk on The Art of Klingon Programming. It's not something I can ever imagining wearing for more than an hour or two at a time, as it's hot, and doesn't breathe. Of course, it's fantastic when you want to hang out with the cast of Trek in the Park.

Talking of The Art of Klingon Programming, it looked like it came across smashingly well, but I had forgotten to remind the audience to rate the talk if they liked it. So if you were there, and you enjoyed the session, go rate it now. ;)

I went to less parties than last year, and so met fewer people, but I was able to spend more time with people who I really enjoy as a result. One of the highlights was a beach trip down to Santa Cruz and around to Half Moon Bay, with some pretty spectacular beaches, cliffs, and even a light-house.

San Francisco
After the conference was a trip to San Francisco, staying with Julian (the most amazing photographer ever), and Jackie (the most amazing story-teller ever). Julian and Jackie's house was a hub of creativity and creative people. If I hadn't been so happily exhausted for OSCON I would have made more of it, but as it was I feel I was almost bordering on impolite by crashing and immersing myself in e-mail.

The next day involved a relocation to Skud's house, a home-cooked meal (my first since Schwern's excellent cooking in Portland), and discussions about San Francisco burrito etiquette, gender issues, booth babes, Australian history, pirates, musicals, and conferences. Skud, Schwern, Jacinta, myself, Valorie, and Andre, who I thought I had never met went out for lunch and ice-cream. Of course, in true small world fashion, Andre was Australian, and knew me from linux.conf.au. He's now working for Pixar, which sounds pretty sweet.

My last day in America involved Schwern, Jacinta, and myself going of a tour of the more touristy parts of San Francisco. Crabs and clam chowder seem to be a big deal in these parts, and I was given a "sample" of chocolate that I'm sure provided me with my daily intake of sugar in a single bite. Unfortunately we didn't have enough time for a big get-together of all the SF residents and visitors before I had to fly out. The flight home was good, with an unexpected exit row seat providing lots of legroom.

Home
The only downer of the whole experience is that Jacinta had managed to wrangle me a cool (first generation) Google Android phone, which I discovered that I loved dearly, but which seemed to have fallen from my pocket inside the taxi home. Attempts to recover it were without success, and without having first recorded all the handset details I can't remote-brick the phone, so it's unlikely I'll ever see it again. Jacinta's now given me her android phone, and while I feel incredibly special and grateful, I'm paranoid about losing it, too!

Today I'm preparing my new laptop, which is about twice as awesome as my old one, comes with a three year worldwide warranty, and costs only a third of the price. Moore's Law + USA = Laptop win. I'm also paying bills, sending out invoices and faxes, paying super, catching up on tax, and generally doing all the things that keep a small business running.

Tonight I'm on a flight to Europe for YAPC::EU, which possibly represents the first conference ever where I have all my talks prepared and ready before the conference starts. I'll be back in Australia in a couple of weeks time, no doubt exhausted from my trip and looking forward to the next one.

Tuesday July 28, 2009
12:16 AM

Around the world with Perl

Around the world with Perl
I've just finished my trip to the USA, which included adventures in Portland and San Francisco/San Jose and surrounds. I had a blast at OSCON, and will post memoirs soon. Right now I'm about to board a plane, fly back to Melbourne, do a stack of paperwork, and then fly off to Europe for YAPC::EU.

A huge thanks to everyone who brought me goodies, showed me around, took me adventuring, let me crash on their couch, took photographs, brought me food, gave me hugs, listened to my talks, commented on my talks, cycled back from hiking, took me to ice-cream, or any of the above.

More blogging when I arrive back in Australia. ;)

Sunday July 19, 2009
02:25 PM

Portland Adventures II

Portland Adventures II
Today is my last day in Portland, and wow, what an adventure it's been. Friday was spent writing slides, relaxing in tea-houses (green mango bubble-tea with wifi rocks!), and a trip to Beer and Blog at the Green Dragon.

Beer and Blog I was particularly pleased with on many different levels. Ua had invited me to this fine establishment at last year's OSCON, and this represented me arriving, albeit a year late. I had a chance to socialise with cool new people, although I didn't realise just how cool some of them are until I did my research.

What made Beer and Blog really special was that during one of my conversations there was a comment that, "there's another Australian here, he's only just moved over". That other Australian was Mike McClure, with whom I went to University, but had not seen in about a decade!

Oh yes, Beer and Blog also had free beer. That also made it special. ;)

That evening was I was given a tour of Portland by Schwern, Kate, Ua, and Nick. That included beer, dinner, a walk along the river, and a trip to Voodoo Doughnuts. I'd been assured many times that my life would not be complete without having gone to Voodoo Doughnuts, and having been there, I can agree.

While I've been in Portland, Selena has been a wonderful host, and I'd felt that I'd been a terrible guest. Selena is a morning person, and I routinely came home late, slept in, and disappeared at odd times for ice-cream or doughnuts. On Saturday morning, I was determined to buck this trend.

With thanks to Jacinta and Schwern who went on a secret ninja grocery mission, I got up extra-early and prepared breakfast. Coffee, juice, amazing toast, and an omelette made with thinly sliced super-fresh swiss brown mushrooms. The look on Selena's face and the huge thank-you hug made it all worthwhile. ;)

The rest of Sunday was amazing. After a snooze I made it to Trek in the Park. This is theatre at its absolute finest. Trek in the Park is brimming over with quality, humour, and superb acting. If you haven't seen it yet, then tonight and next weekend are your last chances to do so, and it won't cost you a cent.

I wore my starfleet uniform to Trek in the Park, which was a huge win. I had arrived a little late, but many members of the audience members must have assumed that I was part of the production, and as such I was able to get a rather nice seat. But the biggest win was the cast reaction; having a guy in uniform and an Australian accent seemed to be something special, which meant that I had no problems meeting the cast, learning about the production, and getting lots and lots of photographs. One amusing fact about the whole thing is that in true cosplay fashion, all the uniforms were made by Kirk's mum. ;)

In the evening was dinner with Stacy, one of my most favourite Portlandians. Stacy was my guide at OSCON 2008, where she gave up much of her time to show me around town, explain the local customs and delicacies, educate me regarding local mushrooms, and stop me from cycling on the wrong side of the road. Stacy was out and about bicycle-hiking this week, but cut short her trip and cycled all the way back to Portland in record time for dinner, making me feel incredibly special.

Today ends my Portland adventures, as I head to San Jose for OSCON 2009, where I'm presenting Doing Perl Right and The Art of Klingon Programming.

Friday July 17, 2009
06:07 PM

Portland Adventures

Portland Adventures
Last year I went to OSCON 2008 in Portland, Oregeon (PDX), and had a fantastic time. I made many great friends, and fell in love with the town and its people. I was looking forward to returning to PDX every year, but unfortunately this year OSCON moved to San Jose.

Not to be denied the Portland experience by mere conference shifts, I arranged to arrive in America a week early, and re-visit PDX the week before OSCON. I'm here right now with Jacinta, and have had an incredibly social time with friends both old and new.

We've been staying with Selena who has been nothing short of amazing. Accommodation, network access, food, transport, good coffee, and most of all fantastic company have made me feel extremely privileged. Selena knows everyone, and is incredibly popular, so we get invited to all the cool events too! I've met more people in the last two days than I can possibly count. Selena also has a beautiful house; and I'm currently sitting under a tree, next to a pond, with a fountain, fish, power, and wireless. I could happily make this my new office.

I've had a chance to catch up with Kate and Schwern, who caught me on the night I landed in PDX for gelato and conversation. Hanging with Kate and Schwern is like fractal socialising; I'll meet someone, discover we have common interests, they'll introduce me to someone else, and the process repeats. It was only at 2am when I was talking to Kate's house-mate's boyfriend about Magic: The Gathering that my body reminded me that I hadn't slept in a real bed for more than 48 hours, and that passing out in the middle of a conversation would probably be considered impolite.

Yesterday I went to the Portland Pirate Shop with the intention of picking up a puffy white shirt, and was informed that I had just missed Plunderathon, and that all the puffy shirts are gone, so I was doubly sad. Next year I'll need to make sure to arrive in PDX much earlier, so I can participate in costumed piratical goodness.

Picking what to do in the evening was hard. Portland seems to be the place where on a Thursday night one needs to choose between a mountain-biking festival, PostgreSQL user-group, Perl hackathon, and Ignite Portland. It's a great place to be a geek. ;)

In the evening I made it to Ignite, which I've decided that I have to speak at if I get the chance. The audience is relaxed, friendly, looking to be entertained, and all have beer. The talks were pretty good, too. I even met one person who recognised me from my work on the Perl 5.8.9 release notes.

Afterwards I made it to the tail end of the hackathon, drank David's beer at a pub that had a huge number of board-games, and retired back to Selena's with Schwern and Jacinta, where we talked late into the night about all sorts of Perl community ideas, including a cute little plan involving community achievement badges that I like to think of as "Perl Scouts". ;)

Wednesday July 15, 2009
05:02 PM

Saudi Arabian Adventures, Days 6-7

These are the last of my Arabian Adventure blogs, which means I'm now caught up with my blogging backlog in time for OSCON.

Saudi Arabian Adventures - Day 6
Today was my last day of teaching, and a challenging one. I had more variation in students backgrounds and skills for this class, which always makes teaching more interesting. Lots of practical examples seemed popular, so they were the main fare for the day. It's easy to show off Perl's strengths when working with text.

During my week in Saudi Arabia I've discovered a few interesting things. While Saudi Arabia as a country fares poorly with women's rights, it's clear that Aramco as a company (or this campus, at least) was very progressive.

Women aren't allowed to drive on public roads in Saudi Arabia. As one of my colleagues put it, "we're hoping that will change soon, but we've been hoping twenty years". However the Aramco campus isn't public, and so there's no problem with women driving inside. Likewise, Aramco recruits the brightest girls from high school. They go through an English language program, and are then sent overseas (usually America or Europe), to earn their degree. They're required to work for Aramco for an equal period to the time they spent studying overseas, although it appears most continue working well beyond that. It sounds like an almost identical scheme to what Australia has with some defence force scholarships.

On my class I had three women out of twenty-four students overall, which is on par for what we get for courses conducted inside Australia. I fear the gender imbalance in IT is a worldwide problem.

Saudi Ararbian Adventures - Day 7
My last day in Saudi Arabia didn't involve teaching, something for which I was extremely grateful. My body clock had fully adjusted to local time, so waking up at 5am was now feeling like waking up at 5am. I slept in, slept some more, had brunch, and walked down to the entertainment complex. It wasn't very busy, and nobody seemed interested in checking passes, so I walked straight in. Sure enough, there was a bowling alley, a cafe, and a library.

I had a late flight back to Dubai, and Fuad had very generously offered to show me about in the afternoon, Breaking the "never turn down an adventure" rule, I actually called Fuad, and turned down an adventure. I was utterly exhausted from the last week, and I seemed to have an endless amount of e-mail and patches to catch up on.

The lack of adventure during the day was more than compensated by the taxi ride that night. It appears that cars put on their hazard lights to tell other road users that they're sticking to the speed limit. In fact, the speed limit appears as if it's the minimum speed at which people are willing to drive.

When we got to the airport, I sighed a huge sigh of relief, thanked my driver, and grabbed my bags. There was an awesome looking mosque opposite, and I went to grab my camera for a photograph. Then I noticed that outside the airport were two guards, heavily armed, and sitting on a tank, smoking. This would have made an even better photograph, until I realised I'd be photographing two heavily armed guards, on a tank, that was parked next to a "no photographs" sign, in a country where I don't speak the language. Consequently, I decided to leave the camera in my bag.

The airport was like airports everywhere, although with less respect for the "no smoking" signs. Most notably, one of the guards who was screening baggage was smoking. Again, I thought this would make a great photograph, and again I thought better of it. Despite the fact that I was told that everyone in Arabia smokes, I actually found it to be quite rare, despite the exceptions I've mentioned here.

Getting through passport control took only one hour, as opposed to three hours getting into the country. I discovered that the airport has a duty free section, but it was rather small, and didn't appear very popular.

The flight back to Dubai was short and pleasant. One of the cabin crew had recognised me from my flight from Melbourne, and we had a nice chat. Another managed to find what I swear was the best coffee I'd had all week. I suspect they have a secret espresso machine hidden in business class, which was broken out purely for my benefit.

Arriving in Dubai I remembered to pick up both my bags, changed my Riyals to Dirhams, and looked at the time. It was about 2:30am in Dubai, which made it around 8:30am in Australia. Through the wonders of free wireless at Dubai airport, and VoIP, I called home for satisfying price of about 2.5 cents/minute.

A short taxi ride later, I was in my hotel, with NetStumbler running and me waving my laptop around on the balcony. I discovered a lack of promising hotspots, and went to sleep.

You read my adventures in Dubai starting here .

Wednesday July 08, 2009
12:33 AM

Saudi Arabian Adventures - Days 3-5

These events happened during my recent trip to Saudi Arabia.

Saudi Arabian Adventures - Days 3-4
On the third day of teaching my class swapped over to new students at lunchtime. Included in this group was Abdulaziz, who I had spoken to on the phone a few times, and who formally introduced me to the class on the first day. Abdulaziz spoke English with an American accent, and I was later to learn that he gone to college in America.

Lunch on the second last day Abdulaziz took me to the golf course. Saudi Aramco has a huge golf course, with beautifully kept grass, and is in stark contrast to the surrounding desert. Here they serve a variety of meals, cooked to order. Since it was the middle of a business day, nobody was actually playing golf.

There have been a few things that I've noticed over here. Business attire is very much traditional western or traditional Arabic, with both being very common. Teenage girls can be often seen wearing flowing black over-robes that were very Harry Potter-esque. Lawns and garden beds are covered with a huge number of very fine mist sprinklers, and they run during the day. These sorts of sprinklers are practically outlawed in Australia, with most states suffering from severe water shortages.

At the food hall, I learnt an important lesson. If I was asked if I wanted something to "take away", then that actually meant the food serving would feed a football team, and my answer to such questions should always be in the affirmative. The first time I foolishly said no, and found myself wondering what to do with the incredible amount of food in front of me.

Having wireless access in my room is a real blessing. I don't know where I'd get it otherwise.

Saudi Arabian Adventures - Day 5
Today was my second-last day of teaching, and Abdulaziz informed me that I needed to make sure the class finished early (3pm) as a meeting had been arranged between myself and management.

To make my day more interesting, we had a trainer who wanted to install software for her course next week. Her name was Tina, and her opening line was "Hi, you're a software developer, aren't you?" When I asked how she knew, she claimed "It's the look. You're all trendy, with long hair." That's the first time I've ever heard developers get called trendy, so I can only assume that I mis-heard.

At 3pm we finished early so that I could meet with EDMD management. For some reason, whenever anyone said "EDMD" I would hear "AD&D", my mind would fill with images of dungeon-crawling geologists in flowing black robes fighting an onslaught of umber hulks.

The meeting with management was made more interesting because I didn't have my Aramco ID, which meant Abdulaziz had to make a couple of bluff checks at the security checkpoints to get me through.

The meeting itself was very management-focused. What does Perl do, who uses it, what's its future, and so on? I honestly don't know how I fared with these questions, and in hindsight I fear my answers may have been a little too much on the technical side, but everyone seemed happy.

Afterwards I met Omar, who I had spoken to on the phone a number of times before my trip, but who wasn't enrolled in the course. Omar is a dual-classed geo/developer, and already knows Perl. It also rapidly became apparent that he was very open-source friendly. "We have a program that parses $horrible_file_format, and would like to bundle it into a module and release it to the CPAN. Is that something you can help with?"

That night, Fuad, Abdulaziz, Omar and Mohammed took me out to a traditional Arabic restaurant. The trip getting there was an adventure in itself. Saudi Arabia seemed to lack anything resembling road rules, or if they existed, they were ignored by most of the drivers on the road. Lane-changes happened at random, and cars would speed down the road at breakneck velocity. The primary form of communication between drivers was a brief flash of high-beams, which meant "I am going 40km/hr faster than you, and I'm not changing lanes. You should." This was in stark contrast to driving inside the Aramco campus, where everyone was slow, careful, and polite. Somehow, Omar drove through all this without breaking a sweat or losing his cool.

In the car we talked about content management systems, web technologies, AJAX, Catalyst, Jifty, PHP, package management and deployment, virtual worlds, and a variety of other FOSS-oriented technical subjects. This was good, as it distracted me from the traffic around us.

At the restaurant I was treated to Arabic coffee, which apparently is made from the unroasted beans, and is very good. It also rapidly became apparent that this was a restaurant/museum, with many historical photos and items on the upper floors. There was a large water feature in the middle of the building, and a large lantern feature. It was explained to me that these sorts of lanterns were traditionally lit and placed outside houses at the start of the month of Ramadan.

After a tour of the historical section, we were given quite a banquet of food, some items which I have had before (such as the dips), and some which I had not. One of the most memorable (and most tasty) dishes was a thick paste made of a variety of grains. This was eaten with a thin broth, and stuck to one's teeth almost immediately.

After dinner, and tea, and dates, and more talking, we drove back to the camp, with discussions mostly focusing around virtual worlds, 3D web interfaces, and tunnelling procedure calls from Second Life to Perl.

Sleep was an immediate priority when I returned to my room, as it had become quite late, and I was certain I'd need an extra cup of coffee to get me up in the morning.

Wednesday July 01, 2009
12:45 AM

Autodie 2.00 released

Autodie 2.00 released
This weekend the long awaited autodie 2.00 for Perl was released to the CPAN, which was almost immediately replaced by 2.02, which fixes some oopsed tests and which adds a couple more features to give us a really sweet experience. This blog entry assumes you're using 2.02.

Observant viewers will notice that the major version number has changed. I've taken the great leap from 1.999 to 2.00. Clearly, something is different, and you might be wondering what.

Well, autodie 2.0 now supports a hinting interface for user-defined subroutines. Put simply, if you have a user-defined subroutine that does something funny to signify failure, you can now tell autodie about that. Once it knows, it can Do The Right Thing when checking your subroutine. You can even put the hints into the same file as those subs, and if someone is using autodie 2.00, it will find the hints and use them.

This may not sound very exciting, but it is. It means that a lot of really ugly error-checking code, both on the CPAN and the DarkPAN, can go away. Lexically. Still not convinced this will change your life? Let's look a little more closely; trust me, you'll like it.

Let's pretend you're working on a piece of legacy code. For some reason, the people who wrote this code decided the best way to signal errors is by returning the list (undef, "Error message"). I don't know why, but I've seen this anti-pattern emerge independently in three 100k+ line projects I've been involved in.

sub some_sub {
    if ( not batteries_full() ) {
        return ( undef, "insufficient energy" );
    }

    if ( not coin_inserted() ) {
        return ( undef, "insufficient credit" );
    }

    my @results = some_calculation();

    return @results;
}

If you want to check to see if some_sub() returns an error, you need to capture its return values, look at the first one to see if it's undefined, and if it's not, use the second one as your error. At least, that's what you're supposed to do.

What actually happens is most developers decide that's way too hard, and don't bother checking for errors. Then one day, the batteries on your doomsday-asteroid-destroying-satellite go flat, nobody notices, and through an ironic twist of fate you're left as the last known human survivor, and there are zombie hordes and walking killer plants outside.

So, how can autodie help us? Well, before version 2.00, it couldn't. But now, with autodie::hints, it can! We can give autodie hints about how the return values are checked. They look like this:

use autodie::hints;

autodie::hints->set_hints_for(
    'Some::Package::some_sub' => {
        scalar => sub { 1 },
        list   => sub { @_ == 2 and not defined $_[0] },
    },
);

Our hints here are simple subroutines. If they return true, our subroutine has failed. If they return false, it's executed successfully. Notice that our scalar hint always returns true. That's because we consider any call of our subroutine in scalar context to be a mistake. It's returning a list of values, and you should be checking that list.

Once we've set our hints, we can then use autodie to automatically check if we're successful:

use Some::Module qw(some_sub);

sub target_asteroid {

    use autodie qw( ! some_sub );

    # autodie has lexical scope, so only calls to some_sub inside
    # the target_asteroid subroutine are affected.

    my @results = some_sub();     # Succeeds or dies
}

sub target_ufo {
    my @results = some_sub();

    # autodie is out of lexical scope, so we have to manually
    # process @results here.
}

If you're wondering what that exclamation mark means, it means "insist on hints", and is a new piece of syntax with autodie 2.00. If for any reason autodie can't find the hints for some_sub, our code won't compile. That's a very good thing, and avoids us having a false sense of security if we use autodie on an unhinted sub.

However the error messages from autodie aren't really that useful. They're going to be things like "Can't some_sub() at space_defense.pl line 53". There's a noticable lack of explanation as to why some_sub() failed.

Luckily, since the way early versions of autodie, we've been able to register message handlers. And with the new features in autodie 2.02, we can produce very rich messages. Let's see how!

use autodie::exception;

autodie::exception->register(
    'Some::Module::some_sub' => sub {
        my ($error) = @_;

        if ($error->context eq "scalar") {
             return "some_sub() can't be called in a scalar context";
        }

        # $error->return gives a list of everything our failed sub
        # returned.  We know this particular sub puts the error
        # message the second argument (index 1).

        my $error_msg = $error->return->[1];

        return "some_sub() failed: $error_msg";
    }
);

Now, whenever some_sub() fails, it'll print a genuinely useful message, like "some_sub() failed: Insufficient energy at space_defense.pl line 53". Yes, autodie automatically adds the file and line number for you. Nice!

But wait, there's more! We don't want to see this sort of code floating around in your programs. You may be dealing with other people's modules that you can't modify, so we can't hide all this configuration in there. So, we can write our own pragma that contains all this info. Here's the full code for a theoretical my::autodie pragma, and is the exact same code used by the t/blog_hints.t file in autodie's test suite.

package my::autodie;
use strict;
use warnings;

use base qw(autodie);
use autodie::exception;
use autodie::hints;

autodie::hints->set_hints_for(
    'Some::Module::some_sub' => {
        scalar => sub { 1 },
        list   => sub { @_ == 2 and not defined $_[0] }
    },
);

autodie::exception->register(
    'Some::Module::some_sub' => sub {
        my ($E) = @_;

        if ($E->context eq "scalar") {
            return "some_sub() can't be called in scalar context";
        }

        my $error = $E->return->[1];

        return "some_sub() failed: $error";
    }
);

1;

It works exactly the same as regular autodie, except it also knows how to handle some_sub(), and display good looking error messages. Here's how we'd use it:

use Some::Module qw(some_sub);
use my::autodie qw( ! some_sub );

my @results = some_sub();  # Succeeds or dies with a useful error!

There's a lot more you can do with autodie, and if you want to learn more, I'd suggest coming to my talk at OSCON or YAPC::EU, where I'll be covering all this and more, with a distinctive Star Trek twist. ;)

Wednesday June 24, 2009
09:31 AM

Saudi Arabian Adventures - Days 1-2

Note: Pictures of my trip to the Middle East are now available.
The events in this entry happened on 12-13th June

Saudi Arabian Adventures - Day 1
My first true day in Saudi Arabia was one of rest. After 30+ hours of travel, being able to sleep in a bed was truly lovely. I woke up fairly late in the day, caught up on e-mail, and then decided to go exploring. There was a food hall just around the corner from the hotel, and while I gawked at the sign displaying opening times, (I was concerned I had missed lunch), and worried about the wording that said the hall was for Saudi Aramco staff only, one of the staff members waved me in with a smile.

What I discovered is that the food hall has both very good and very affordable food. Cans of drink, bottles of water, and cups of coffee were almost universally 1 riyal (about $0.30 AUD). Some basic meals were available for about 4-5 riyals (under $2.00 AUD), with the best value for money undoubtedly being the "budget meal", which provided soup, vegetables, rice/potatoes, a generous main meal serving, and a dessert, all for 11.5 riyals (about $4 AUD).

I got myself a salad (which were excellent), some soup, and some coffee, and felt very thankful that I had changed myself some 300 riyals (about $100 AUD) while in Dubai, since I hadn't spotted any way of doing money exchange at the Dammam airport.

The rest of my travels included a walk around the camp, the most interesting part of which was a fenced area that seemed to include a library and a bowling alley. Here also a large sign proclaimed the facilities were for Aramco employees only, and passes will be checked on entry. I was getting the feeling that having an employee pass would be a good idea.

Saudi Arabian Adventures - Day 2
Today was my first day of teaching. Fuad, my contact at Aramco, had arranged to meet me at 7am at the hotel, and I had noted from my trip to the food hall yesterday that it opened for breakfast at 5am. Collectively, these were hints that Saudis were morning people. I set my alarm for 5am, which in my jet-lagged state would feel like waking up at noon in Australia.

Going to the food hall for breakfast once again had me feel like I was in America; the most popular food that people ordered were waffles! Of course, I didn't fly half-way around the world just to have waffles for breakfast, so I ordered a generous bowl of ful medames... and waffles.

Of the two breakfast foods, ful was the clear winner. It tasted good, and unlike the waffles, it had actual nutritional content. I finished breakfast with plenty of time to meet Fuad back at the hotel at 7am.

Fuad chuckled at my attempts at an Arabic greeting, and asked in perfect English "where are you learning this stuff, a phrase book?". I think that means my Arabic has some ways to go. ;)

Fuad asked about my flight here, explained that the Aramco camp was generally divided into zones, the general business hours (7:30am-3:30pm), and helped me get set up with my lab. I was also glad to hear he would be attending my first course.

At this point, I should explain a little about what I was teaching. My class consisted primarily of people with job titles that started with "Geo-", and who regularly had to deal with data that was in formats different to what they would prefer. Unsurprisingly, they'd like to use Perl to help solve these problems. That's an increasingly common story with the courses I teach.

What made this interesting is that rather than having a good four or five days (which is what I'd prefer), I was teaching two classes, a dozen students in each, with only 2.5 days per class. To top that off, I was in a different country, and I had no idea how comprehensible my Australian accent would be. I'd put together a plan that covered the basics (syntax, variables, and control structures) a tour of the CPAN, and as much regexp content as I could squeeze in.

When we were doing introductions, it became clear that my class had a good sense of my humour. My favourite introduction was from one student who said "my name is very hard to remember... it's Mohammed".

The first day of teaching went well, and from the bountiful, well-thought out questions, it was clear that I was being understood.

Sunday June 21, 2009
12:45 PM

Dubai Adventures - Day 3

Dubai Adventures - Day 3
Today I decided to travel to Jumeirah beach and surrounds, a decision I made purely based upon the number of tags and photographs in the area for Google Earth. Since I'd be doing this during the day, I decided to take a practical approach. I left the laptop and most electronics back in the hotel, and packed lots of water and sunscreen. I wore my most breathable cotton top, a linux.con f.au hat, and what Jacinta calls my "pirate pants". These pants are very loose, and very breezy, and very comfortable. But as a result, I didn't look like a local, and I didn't look like a typical tourist, either. I was, however, protected from the sun and reasonably cool.

I caught a taxi to Jumeirah mosque, for just a little over 10 AED (about $3.50). I didn't expect to find the mosque open (and indeed, it wasn't), but I got some nice photographs. The main reason I wanted to visit the mosque is that it was walking distance to the beach, and (if you're me) Sheik Zayed Road. While two days ago I had discovered that walking around the old souks resulted in someone trying to sell me a fake rolex every few minutes, today I discovered that walking around Jumeirah had a taxi beep at me every few minutes, hoping that I would need a lift somewhere.

Jumeirah beach is very pretty, and very hot. There weren't many people out, and a lifeguard watched lazily from a tower. The beach came with lots of rules, one of which was "strictly no cameras", so I had to be a little more discreet with my photographs. The water looked extremely inviting, and I relished the idea of hopping in for a swim. Unfortunately (and accidentally), I had left my swimming gear back in the hotel, and my mask and snorkel back in Australia.

At the beach I got some great photographs of the skyline of Sheik Zayed Road, especially of the Burj Dubai, which distinctly reminds me of the Combine Citadel in Half-Life 2. Having looked around the beach, I decided to head off toward Sheik Zayed road, which I was certainly would be filled with marvels.

The walk was a lot harder than my previous wanderings around Bur Dubai, even though the distance was shorter. I was walking through a residential distract, and as such there was a lot less cover, and fewer amenitities. It was clear that Jumeirah was home to the rich, with magnificent mansions and expensive cars.

After about 1.5km of walking from the beach, I was finding that the heat and exposure was making me a little uncomfortable, and that while I had packed a lot of water, I'd probably need to think about looking for more. Luckily, I had just chanced upon a park. It was beautiful, green, lush, and immaculately maintained. For some reason, the gate was shut, with a large padlock, and it looked as if this gate had been shut for some time. Perplexed, I went to a second gate, and it was also closed. I noticed a person in the park, but he appeared to be a groundskeeper, who was distracted by talking on his mobile phone. This had me even more perplexed; why spend water, and money, and high-value property on creating a park that nobody can get into? This wasn't marked as a private park, and it even had a playground in the middle of it. Maybe it closed during the middle of the day, and re-opened later on?

A climbing check, and two stealth checks later, I found myself a section of soft grass and a shady tree under which to snooze. I woke after about half an hour, a little surprised that the groundskeeper hadn't woken me. Refreshed, I continued on my way, and discovered much to my delight that Dubai has public refrigerated drinking founains. With my water bottles refilled, and my face and arms splashed with blissfully cold water, I continued onwards.

The region I was walking through seemed to be filled with houses that were universally big. However one house in particular stood out. It was on the corner of two streets and was unfinished. That in itself is nothing special; Dubai seems to be in a constant state of construction, but it was clear this building had been unfinished for quite some time. The shell was made, but that's all which was there. Amusingly, a sign on the side said "For Sale or Rent".

After walking past another park (also beautiful, closed, and deserted), I eventually reached Sheik Zayed Road. This is the home to many of the tallest buildings in Dubai, and is a spectacular sight from the air, but amazingly dull on the ground. These were hotels, and office blocks, and the odd food outlet here and there. It was also completely impossible to cross on foot. It looked like some footbridges were under construction, but they were nowhere near finished, and they were so big I suspect they were for yet another road link, and not meant for pedestrian traffic at all.

I walked down the street, and got some decent photographs. My plan was to walk across to the Dubai Mall, take a look around, and then walk up the other side of Sheik Zayed Road to the Emerites Towers. As it happened, try as I might, I couldn't find a way to get across the street, which has twelve lanes, and cars travelling at considerable speed.

Hot, disappointed, and tired, I decided to try and find someplace cool, and preferably with restrooms. Being Dubai, there was a small mall not too far away, and I made my way toward it. It had a supermarket, and an electronics superstore, and in a rare moment of impulse purchasing, I grabbed a copy of EA Sports Active (which apparently sucks less than Wii Fit), after carefully checking it for any signs that indicated that perhaps it would only work in certain regions.

If I had my laptop with me, I would have pulled out my maps and looked for interesting activities, but since it was not available, and since I had gone all this way to discover that Sheik Zayed road sucked, I hailed a taxi to get back to town. This was one of the best parts of the day, since the driver was very talkative. He was from Pakistan, to which he'd love to return, but apparently there are no jobs there. He had worked previously in the Ukraine, and had moved to Dubai eight months ago.

My driver commented that Dubai is an artificial city. It's got artificial islands, artificial buildings, artificial snow, and artificial parks. People are here because Dubai has done an amazing job of marketing itself to the rich, but due to the global financial crisis, the rich aren't rich anymore, and they're flying back overseas. Tourism is down, jobs are more scarce, and so many of the not-so-rich who have come here for work are also going back overseas. Apparently all this was great reducing traffic congestion and getting me back to my hotel, but it sucked for the city as a whole.

Back at the hotel I had a bite to eat, and wrote this blog. My plane leaves at 9:35am, which means I want to be at the airport at 7:35am, which means I want to be leaving the hotel at 7am, which means waking before that. If I want to avoid too much jet-lag I should be going to bed now, and waking super-early in the morning. Instead I'm here posting blog entries, and discovering that the the UAE censors flickr, so there won't be any photographs until I get home.