Travis and Dist::Zilla projects

Getting started with Travis

I felt like I should give Travis a try and picked a recent github project of mine that I knew had a decent testsuite.

The instructions on how to get started with travis were quite simple and soon the project had its own travis page.

Unknown build failure

I wondered why the ="https://travis-ci.org/da…

Splitting a Catalyst App and recombining it with Plack::Builder

I had a big Catalyst App serving HTML.

Some time later a RESTful interface was needed so I added RESTful controllers using Catalyst::Controller::REST

But that broke Plack::Middleware::CSRFBlock, because the REST calls don't request a form and thus cannot add the secure token to POST requests.

Thinking about a solution it dawned on my that having a single App serving HTML and RESTful requests is probably a bad design choice.

Thankfully most of my business logic is in my DBIx::Class schema so splitting up one Catalyst App into two Catalyst Apps under the same nam…

Asynchronous Task Distribution with AnyEvent and ZeroMQ

Some months ago i wrote how to (ab)use your database as a messagequeue in order to distribute tasks among worker-processes.

"From your code, it also looks like having more than one demon will put you at risk of processing the same jobs more than once." (Jerome Eteve)

"Abuse" is the right word. The moment you hit more than three concurrent jobs, you will see a nasty slowdown ..." (rob.kinyon)

The comments made pretty clear that this was not a go…

bulk inserting tens of thousands of rows with DBIx::Class

For some crazy reason my $project had a denormalized database layout. I had a table 'job' with a column 'data' which had a serialized ArrayRef of HashRefs as value.

But performance turned out to be really bad, I did not take any premature measu…

Relationships with optional foreign key values (DBIx::Class)

This entry demonstrates how to implement a relationship with optional foreign key values using DBIx::Class.

Imagine two related tables 'human' and 'cat': A cat belongs to a human but when the human dies the cat can continue to roam freely.

package MyApp::Schema::Result::Human;
use strict;
use warnings;
use base 'DBIx::Class';
__PACKAGE__->load_components(qw/ Core /);
__PACKAGE__->table('human');
__PACKAGE__->add_columns(
    id => {
        data_type         => 'integer',
        is_auto_increment => 1,
        is_numeric        => 1,
    },
);
__PA…