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

jonasbn (1153)

  reversethis-{gro.napc} {ta} {nbsanoj}
AOL IM: BJonasN (Add Buddy, Send Message)

Perl Programmer located in Copenhagen, Denmark. Active member of Copenhagen Perl Mongers.

Author of:

  • Business::DK::CPR
  • Business::DK::CVR
  • Business::DK::PO
  • Business::OnlinePayment::CashCow
  • Date::Holidays
  • Date::Holidays::Abstract
  • Date::Holidays::Super
  • Date::Pregnancy
  • Games::Bingo
  • Games::Bingo::Bot
  • Games::Bingo::Print
  • Module::Info::File
  • Module::Template::Setup
  • Test::Timer

and maintainer of:

  • Tie::Tools
  • XML::Conf
  • Workflow

Journal of jonasbn (1153)

Tuesday November 18, 2008
04:46 PM

Moving day... my journal has a new home

I wrote my first entry here back in June 2002 on the 30th. Time to move on...

Take care and thanks for all the good, funny and insightful comments...

Monday November 10, 2008
04:26 AM

use.perl - giving up?

I am experiencing serious trouble attempting to post journal entries to use.perl.

Somebody else complained about this and somebody else responded, but I cannot find the entry again :-/

use.perl has been my primary blog for a long time, perhaps it is time to move on...

04:17 AM

Project Evaluation: PDF Contract

This assignment was a small one, estimated to about 20 hours, it did however go a bit over estimate. The project scope was to develop a form to collect data to populate a PDF page.

I know that the PDF format has a form technology integrated, but I did not have the time to investigate this any further. so I spent a friday evening prototyping different PDF modules from CPAN and settled PDF::API2. Developing it in Perl would allow me to integrate with the existing framework - a new technology from Adobe or similar was too much of a risk for such a small task.

We started out two developers, this backfired a bit when we got to integrate the two parts we had developed and we spent a lot of time testing and debugging. I ended up wrapping up the project myself.

  • + Good prototyping
  • + PDF::API2
  • Best practice: component separation
  • - Lack of focus, too much on the table
  • + Two developers
  • - Lack of communication between developers
  • + Good additions to new application super class
  • - UTF-8 problems, we always have issues with UTF-8, see also below
  • + UTF-8 problems, we are getting very good and solving UTF-8 issues, some time in the future we will not experience UTF-8 issues I hope
  • - Too many iterations and bugs, I do not mind many iterations, but in this case it was getting silly since the iterations became necessary due to bugs introduced during development and bug fixing, lacking automated test could perhaps have addressed this
  • + Lacking human test in development phase, we just delivered stuff to test, which contained rookie mistakes - lack of focus and automated tests too blame (developers)
  • - Lacking automated test, almost no automated test (see below)
  • - Non-testable code, the application was designed so it was hard to test programatically, the output was a PDF. This gave me the idea for PDF::Template (see below). The idea would be to use a Data::FormValidator (DFV) like strategy where the actual rendering of the PDF would respond with a result set much like DFV, so data written to PDF and not-written would be reported back as return value for evaluation. This would be a shallow, but useful evaluation of the process. Re-processing the PDF post-rending would of course also be an option, but much more heavy-weight.
  • Reflection: Hash::Util (lock_keys), this module (see Perl Hacks #87 Lock Down Your Hashes), this could have helped us connecting the two components developed so we would not have experienced so many bugs
  • TODO: Add support for additional headers in existing Response class
  • Possible TODO: PDF::Template (see above)
  • - Diversity in platform (air-bubble bugs?), a really bothering thing, when moving from test to production, other bugs appeared. this would leave us to test in production, a practice which is bad in my opinion. Environments should be as uniform as possible
03:34 AM

Standing a little taller

I do not quite understand why the court ruling involving the Artistic License has not got more blogging time in the Perl community.

I read an article on the case in Dr. Dobbs, after seeing it mentioned in non-perl RSS feeds.

The article mentions members of the Perl community I have met and our very own Perl Foundation.

So from here a huge cheer and congratulations on the outcome as the author of the article writes:

It's a big deal.

Sunday November 09, 2008
03:19 PM

iPod+Nikeplus+, plans implemented in Perl

So I sat down with the training plans I (somewhat) followed preparing for last years Copenhagen Marathon and attempted to layout a plan, but lazyness got me so I wrote a script.

The date for next years Copenhagen Marathon in 24th. of May 2009 (the argument to the script).

Here is the output (the training plan):

hoarfrost /Users/jonasbn/Desktop
; perl 24052009
Week: 01 Week number: 50 Distance: 35
Week: 02 Week number: 51 Distance: 30
Week: 03 Week number: 52 Distance: 40
Week: 04 Week number: 1 Distance: 40
Week: 05 Week number: 2 Distance: 40
Week: 06 Week number: 3 Distance: 35
Week: 07 Week number: 4 Distance: 45
Week: 08 Week number: 5 Distance: 45
Week: 09 Week number: 6 Distance: 45
Week: 10 Week number: 7 Distance: 40
Week: 11 Week number: 8 Distance: 50
Week: 12 Week number: 9 Distance: 50
Week: 13 Week number: 10 Distance: 50
Week: 14 Week number: 11 Distance: 45
Week: 15 Week number: 12 Distance: 55
Week: 16 Week number: 13 Distance: 55
Week: 17 Week number: 14 Distance: 55
Week: 18 Week number: 15 Distance: 50
Week: 19 Week number: 16 Distance: 60
Week: 20 Week number: 17 Distance: 65
Week: 21 Week number: 18 Distance: 65
Week: 22 Week number: 19 Distance: 50
Week: 23 Week number: 20 Distance: 45
Week: 24 Week number: 21 Distance: 20

And here is the script:

    # $Id$
    use strict;
    use warnings;
    use DateTime;
    use constant DAYS_IN_WEEK => 7;
    our $VERSION = '0.01';
    my @distances
        = qw(20 45 50 65 65 60 50 55 55 55 45 50 50 50 40 45 45 45 35 40 40 40 30 35);
    if ( !$ARGV[0] ) {
        die 'Usage: <date of marathon ddmmyyyy>';
    #parsing argument
    my ( $day, $month, $year ) = $ARGV[0] =~ m{
        (\d{2})  #day (two digits)
        (\d{2}) #month (two digits)
        (\d{4}) #year (four digits)
    #DT does it own dying
    my $dt = new DateTime(
        year      => $year,
        month     => $month,
        day       => $day,
        time_zone => 'UTC',
    #Using DateTime (machine) to go back the number of weeks scheduled in distances
    #minus one of be of by one week when we get to the marathon, eventhough an
    #extra week of preparation might not hurt
    $dt = $dt->subtract(
            days => ( DAYS_IN_WEEK * scalar @distances ) - DAYS_IN_WEEK
    #Print the plan from the beginning and on...
    my $i = 0;
    while (@distances) {
        printf 'Week: %02d', ++$i;
        print "\tWeek number: " . $dt->week_number();
        $dt = $dt->add( DateTime::Duration->new( days => DAYS_IN_WEEK ) );
        print "\tDistance: " . pop @distances;
        print "\n";
    exit 0;

Of course the scripts TODO list would be long, things like localization etc. should be taken into consideration.

11:06 AM

iPod+Nike+, skipping

I skipped the Sparta training 13 km. run. My legs are sore after doing 30 km. last week and cleaning/emptying our attic Saturday (which is on the 5th. floor).

Tomorrow night I will do my regular 10 km. and next Sunday I think I am up for something a bit longer.

Soreness and everything taken into consideration it feels really good to be running again and I am aiming for doing 10 km. in 45 minutes.

Thursday November 06, 2008
05:22 AM

iPod+Nike+, new chip

Made 10 km. again yesterday. My time was about 50 minutes, which I think is quite good after such a long break.,runs,1755202461,runID,808694827

I bought a new chip from Nike/Apple the day before and it just works out perfectly, so now I can start logging some kilometers again - yay!

05:17 AM

Business-DK-CPR 0.04 released

Finally I was able to get this release uploaded.

The list of changes is long, mosy important change is that by now I support the new CPR numbers issued in Denmark.

Should be at your local mirror shortly.

Tuesday November 04, 2008
04:09 AM

iPod+Nike+, running plans and getting started

Ok, yesterday I got my running schedule laid out.

I have not applied kilometer goals etc. I will do that later on, for now I just need to get into a regular interval.

And guess what! - I did 10 km. last night in 50 minutes. My left leg is hurting a bit today, but I think I will be ready for Wednesday where my next run is scheduled.

Update: And my chip died so I need to get a new set before Wednesday and I have no record of this run anywhere...

Monday November 03, 2008
04:04 AM

ipod+nike+, missing out

Sparta had their first marathon practice run yesterday. I did not participate :-/

I had planned to get up to speed so I could run 13 km, but I have not run a single kilometer.

So my plan is to get ready for next sunday, I feel fat, lazy and weak - I have to get back on track. Running is so good in so many ways.