October 2011 Archives

German Perl Workshop day 3

Yesterday was the last day of the german perl workshop.

Denis Banovic started with a live demo demonstrating development and deployment of a dancer app in the "Cloud". It looked very easy to do.

Karl Gaissmaier was the next speaker explaining a lot of details about Captive::Portal, a hostspot software his university developed.

Stefan Hornburg talked about various advanced features of and his experiences with Dancer.

After lunch, Rolf Langsdorf held a very interesting talk comparing Perl and JavaScript. After that, Herbert Breunung had two talks: Thoughts about better documentation and a comparison of Hg and git.

And the last two speakers were Richard Lippmann discussing the usage of the right language for programming projects and Renée Bäcker with tips and tricks for doing talks.

All to gether, this was a great workshop. I will definitely attend next year's workshop which is in Erlangen from March 5 to March 7, 2012.

German Perl Workshop day 2

Today, we had more talks than yesterday. Marc Chantreux talked about his module, 'Perlude', an interesting CPAN module porting some of Haskel's ideas to perl.

Gerhard Schwanz presenting Mapweaver was the next speaker, directly followed by Denis Banovic presenting the simplicity of Dancer. For me, this talk was the best of today.

Steffen Ulrich gave an excellent introduction into TLS and explained some recently happening issues and how they could occur.

As a replacement for an omitted talk, Heiner Kuhlmann presented a tool to display some software quality metric values graphically. Nice to see Perl-Critic in colored boxes :-)

Herbert Breunung talked about some features of Perl 6. Whenever I hear him talking, I wish Perl 6 was already production-ready. All the new features are really awesome!

The last two speakers before the lightning talk session were Rolf Langsdorf showing a way of using macros to expand Perl 5 and Lars Dieckow who gave another SSL talk. The Macro-Talk was very impressive but I have to take a look into the sources in order to fully understand what happens under the hood.

As usual, the lightning talks went over too fast. The things I remember most were a new search engine operating under Perl: http://duckduckgo.com and the reminders to next year's German Perl Workshop in March and the YAPC Europen in August.

German Perl Workshop day 1

Today, the german perl workshop 2011 started. Today's keynote was done by Heiner Kuhlmann, who talked about software architectures and refactoring. The interesting point was the parallelism between data structures and software structure. All the time I was comparing his talk with Robert C. Martin's book "Clean Code" which mentioned refactoring a couple of times. The common denominator is that refactoring without intensive testing cannot be successful.

Renée Bäcker demonstrated the use of Role::Basic for non-Moose environments. Looks very useful.

Rolf Langsdorf talked about possibilities to extend Perl's syntax using syntactic sugar and function prototypes. He tries to avoid source-filters and parsers in order to avoid breakage of external tools.

Uwe Voelker talked about HTML5::Sanitizer, a module he wrote to clean uploaded HTML code.

Max Maischein demonstrated Web Scraping techniques using FireFox to allow scraping websites that depend on JavaScript.

Looking forward to tomorrow's talks :-)

Test::DBIx::Class

Today, I tried to test a freshly created DB schema using Test::DBIx::Class. Scanning through the documentation was impossible -- it knows far too many options to get captured within a few minutes. But carefully reading the brilliant manual is worth the time spent. Test::DBIx::Class has a lot of options and test-functions tailored especially to the needs of DB-testing.

My primitive schema knows 3 tables: Sensors, Measures and AlarmConditions. Inside my t/ directory, I needed to create only one supplementary file to allow the tests to get coded: a config file t/etc/schema.pl

{
    schema_class => 'Statistics::EasySchema',
    force_drop_table => 1,
    resultsets => [ qw(AlarmCondition Measure Sensor) ],
    connect_info => ['DBI:Pg:dbname=statistics_test', 'user', 'secret'],
}

My tests started using a blank database which was OK for me in this particular situation with a primitive database like this.

My test-script partially looked like that:

use strict;
use warnings;
use Test::More;
use Test::DBIx::Class;


# ensure DB is empty
is Sensor->count, 0, 'no records in sensor table';


# add a sensor
ok my $sensor = Sensor->find_or_create({name => 'erlangen/keller/temperatur'}),
    'find or create sensor';
is_result $sensor;
is_fields [qw(sensor_id name)], $sensor, [1, 'erlangen/keller/temperatur'],
    'sensor fields look good';
is Sensor->count, 1, '1 record in sensor table';

# more test...

done_testing;

How easy things can be by simply using the right module :-)

About Wolfgang Kinkeldei

user-pic I blog about Perl.