Archive for July, 2008

24h Kartrennen in Saalfelden

July 24th, 2008

Am Start...Es war ein unglaublicher Event. 24h lang wurden die Runden am ÖAMTC Gelände in Saalfelden gedreht. Mit knapp 50 Karts am Start war auch zu diesem Zeitpunkt bereits “Ektschn” angesagt. Unser Leihkart war nach dem unmoralischen Bierkistenangebot an die Mechaniker in einem perfekten Zustand und dank ausgeklügelter Taktik haben wir unsere Wunschstartposition erreicht, Platz 47 von 49. Der Le Mans Start wurde erfolgreich mit der nötigen Ruhe und Eleganz der Gentlemen die wir sind bewältigt. Und wir konnten uns aus allen unnötigen Berührungen und Abflügen ins Grüne in den ersten 3 Runden bewahren, dann ging auch für uns das Rennen los.

Gestartet im 1h Rhytmus konnten wir mit dem System bis in die frühen Morgenstunden fortfahren, erst dann hat strömender Regen und enorm schlechte Sicht die ersten Änderungen gefordert. Aber nachdem auch das Morgengrauen gegen 05:30 die ersten Lichtstrahlung als Hilfe anbot, waren auch wir wieder fest im Sattel und konnten unseren Platz weiter verteidigen. So waren wir erfolgreich zwischen Rang 20 und Rang 15 während des ganzen Rennens platziert und nicht zuletzt durch extrem schonende Behandlung unseres Karts gab es keinen nennenswerten Zwischenfälle. Unser einzig verbliebenes Rücklicht konnten wir mit aggresivem Einsatz von Klebeband in Funktion und Position trotz der vielen Regenstunden halten.

Photos sind in der Gallery.
Weitere Infos auf der Ruck-Zuck Kart Racing Team Homepage

Thoughts on parametrized roles for Moose

July 15th, 2008

Moose is your favorite meta-object system in your favorite language of choice. And you already have a lot of excellent concepts that extend the basic usage of object-oriented programming, like having simple means to override parts of methods (around, before, after) and of course roles.

Roles are great, I even used them for my logging needs in MooseX::Log::Log4perl as stated earlier. After getting getting feedback by Micheal Schilli to add an easier interface for simple logging needs I had two choices to accomplish that:

  • Add another role (and reuse the initial role) like it is implemented currently in MooseX::Log::Log4perl::Easy:

    package MooseX::Log::Log4perl::Easy;
    use Moose::Role; ### Make it a moose role
    with 'MooseX::Log::Log4perl'; ### Reuse the base role with its attributes and methods
    sub log_fatal { my $self = shift; $self->logger->fatal(@_); }
    sub log_error { my $self = shift; $self->logger->error(@_); }
    ...
  • Use a method alias by using import to have a function returning the correct role to use with with. This is exactly what MooseX::Storage does to allow parametrized loading of moose roles to save some typing for lazy people and improving readability.

    use Moose;
    use MooseX::Storage; ### You have to use it to allow import to provide you the Storage alias
    with Storage('format' => 'JSON', 'io' => 'File'); ### Use the function to return the correct roles

The first approch clutters my module package a little, also requiring more documentation and hinting for people to find the module (more of a problem for lazy people like me).
The downside of the second approach is, that you have to use MooseX::Storage first, to have the Storage function exported. And it does not really look like the standard way of adding a role to the object, which is usually defined using quoted string like with 'MooseX::Log::Log4perl'; (note the quotes here).
A solution to that problem might be adding another keyword function to moose e.g. called role that makes use of some import magic and returns the correct role packages to load, also calling role initialization method, that allows to do some role tricks.

use Moose;
with role 'My::Role'; ### no magic here same as: with 'My::Role';
with role 'MooseX::Log::Log4perl' => ':easy'; ### pass a param
### or even
with role 'MooseX::Log::Log4perl', prefix => 'mylog_'; ### pass the param hash/pair to a role

The role keyword would return the correct role method to load, and additionally allow the role to initialize and use the prefix parameter to do some additional initialization, even if that would mean only setting a “_role_param attribute” that could be used later in default coderefs. Using this, would mean that you cannot use multiple roles with the with role keywords, but that’s ok for me, since perl users are used to that anyway, it’s the same for use.

Bringing logging to Moose with MooseX::Log::Log4perl

July 13th, 2008

Finally after some playing around and discovering the main concepts behind moose and failing to find a logging role using my favorite logging system log4perl I sat down an did a little coding (it is really just a few lines) and uploaded to CPAN as MooseX::Log::Log4perl.

As I already received some valuable feedback by Michael Schilli of Log4perl fame, the interface might change a little (staying backwards compatible) to be easier to use for small projects by using something like with MooseX::Log::Log4perl qw(:easy) to give you methods for log_error, log_warn, log_debug, … directly on your class instance.

If your interested see the open RT ticket 37655.

This module was actually written as part of my other project called QuikPlan, a course scheduling and management web application.

Quikplan – Ein neues Catalyst Perl / jquery javascript Projekt

July 4th, 2008

Mein neues Projekt Quikplan geht an den Start. Gemeinsam mit Chris entsteht eine Kursplanungssoftware die speziell auf die Anforderungen einer Kletterhalle (oder ähnlichem) getrimmt ist.

Als Backend dient Catalyst Perl mit diversen weiteren Modulen (Moose, DBIx::Class, …) getrennt über ein JSON basierendes API. Das Frontend ist eine Web 2.0 Applikation basierend auf jQuery und einen eigens dafür erstellten Framework für einfaches und konsistentes GUI Handling.

Die ersten Erfahrungen mit Moose sind sehr vielversprechend und die erste Klasse (ein TransactionManager als Zwischenlayer zu den DBIC/DBI Transaktionen) ist bereits erstellt.

Für mehr Informationen: www.quikplan.at bzw. ein Mail auf die Reise schicken (info A T quikplan D O T at).

primary