If ever there was a word to make someone defensive, it's privilege.

You are brought face to face with the fact that someone else doesn't have the same experiences in life as you and that their experiences somehow make their life harder than yours.

I am one of the most privileged people I know. I am a well-educated European white man. I was raised in a loving, stable home. I have a loving, stable relationship and two children. I am doing well financially, working in a job I love. The list goes on and on and on…

I understand intellectually that not everyone has this good a run in life. But I feel defensive when someone mentions privilege. "But it's not my fault!", I want to whine.

I have friends who are treated as inferior by strangers. I have friends who are not listened to at work because they aren't a white man. I have friends who have been sexually assaulted. I have known this for years and I used to shrug it off as "It's just the way the world is, but not all men are like that.".

This is not acceptable.

I've started paying more attention. I want to be part of the solution, not part of the problem. I will not blithely ignore that the rest of the population have to deal, day-in and day-out, with problems that I cannot ever fathom.

I'm reading articles and watching talks on the subject. I'm listening carefully to what my wife and friends have to say. How else can I learn?

I now know what the Bechdel Test is and I've noticed the lack of female protagonists in new games coming out of E3. I was shocked and depressed by what I read on #yesAllWomen.

I will change my behaviour and the way I talk. I will call out others too.

I will fail regularly in my attitude, in what I say and in what I do. I need my friends to point this out and, when they do, I will not whine.

Missing mime-info database for use with File::MimeInfo

A requirement I have on a current project means that I need to determine the mime type of a file I load from disk.

One way to do this is to use the File::MimeInfo::Magic CPAN module like this:

use File::MimeInfo::Magic;
my $mime_type = mimetype($path_to_file);

However, on OS X, an error was raised:

WARNING: You don't seem to have a mime-info database. The
shared-mime-info package is available from .

The easiest way to solve this is via Homebrew:

$ brew install shared-mime-info
$ update-mime-database /usr/local/share/mime

Speaking at DPC & OSCON

Two conferences are coming up that I'm speaking at:

I'm speaking at DPC 2014

The Dutch PHP Conference takes place in Amsterdam and this year is between June 26th and 28. I'm giving a tutorial with Matthew Weier O'Phinney on Apigility which will provide you with a full day's teaching on creating web APIs with Apigility. I'm also giving a talk called Creating Models discussing the options available when creating the model layer of a typical MVC PHP application.

DPC is a fantastic conference full of great content and people and if you can get to Amsterdam at the end of June, it's well worth your time to attend.

I'm speaking at OSCON 2014

The following month, I'm coming to the US to speak at OSCON which runs from the 20th to 24th July in Portland. OSCON is a massive conference that covers the entire spectrum of Open Source and I'm excited to be presenting Creating Models in the PHP track. There's a lot on the schedule and I expect to learn a lot and meet lots of people from communities that I haven't interacted with much before. I've never been to Portland before, so it'll be interesting to see what the city has to offer too.

If you attend either of these conferences, please come and say hello!

Perl syntax highlighting in Sublime Text 3

I'm currently writing a project in Perl for a client and have discovered that the default Perl syntax highlighting in Sublime Text is terrible.

Fortunately, the community has stepped up and Blaise Roth has created the ModerlPerl package. Install via Package Control.

To get all Perl files to open with the new syntax highlighter, use View > Syntax > Open all with current extension as… and select ModernPerl from the sub-menu.

Injecting dependencies into your ZF2 controllers

When starting working with Zend Framework 2, it's common to copy the skeleton and put your controller definitions in module.config.php like this:

'controllers' => array(
  'invokables' => array(
    'Application\Controller\Index' => 'Application\Controller\IndexController',
    'Application\Controller\Blog' => 'Application\Controller\BlogController',

The controllers keyword is picked up by the ControllerManager which is an instance of the ServiceManager which means that it creates the controller instance for you when the dispatcher needs it.
Continue reading

Sharing host VPN with Vagrant

When moving a project into Vagrant, I realised that I needed the vagrant guest to share my OS X's VPN.

I'm using a separate IP address within a private network like this: :private_network, ip: ""

So, after some Googling, I added this provider configuration setting:

  config.vm.provider :virtualbox do |vb|
      vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]

and now my VM is sending data over the VPN. Note that this will not work when using the Vagrant's public_network setting though.

Immutable entities

I've been thinking recently about using immutable objects for some of my model-layer entities. That is, an object that cannot be changed once it is created.

Immutable objects have a number of benefits including the fact that they are much easier to understand, simple to use and very easy to test. The main motivation for me is that an immutable object is very predictable as it's state doesn't change. This means that any calculated properties can be done once on creation. This is interesting as one application that I'm currently working on has a lot of calculated properties and it's a source of bugs when one property changes and all the dependent calculations aren't always done.
Continue reading