Blog

Blog entries
2008 Apr 03

Strawberry Perl for Windows.
2008 Apr 01

Oslo Hackathon day -4.
2008 Mar 28

Blogging about Perl outside the community?.
2008 Mar 27

OSCON Proposals rejected.
2008 Mar 26

Preparing for the QA Hackathon in Oslo.
2008 Mar 25

Missing licenses on CPAN modules?.
2008 Mar 24

License of Perl Modules on CPAN.
2007 Dec 24

Joining Technorati?.
2007 Dec 24

Regular Expressions in Perl 5.10.
2007 Dec 24

Switching in Perl 5.10.
2007 Dec 24

Smart Matching in Perl 5.10.
2007 Dec 24

What's new in Perl 5.10? say, //, state.
2007 Dec 23

The Zulo interview was published.
2007 Dec 08

Frequency of programming languages on LinkedIn.
2007 Dec 06

Interview in Zulo.
2007 Dec 06

Sun Startup Essentials Launch.
2007 Aug 25

Testing PostgresSQL.
2007 Aug 25

Testing Pugs and Perl 6.
2007 Aug 22

Testing Ruby.
2007 Aug 22

Testing GHC, the Glasgow Haskell Compiler.
2007 Aug 22

Testing NUT, the Network UPS Tools.
2007 Aug 21

Testing SQLite .
2007 Aug 20

Smoked Parrot.
2007 Aug 20

Quality Assurance of Perl 5.
2007 Jul 09

Using mod_perl for szabgab.com.
2007 Jul 07

Quality Assurance and Automated Testing in Open Source Software.
2007 Jul 07

Add tags to CPAN modules via CPAN::Forum .
2007 Jun 15

Windows on VMware.
2007 Jun 13

Reducing the social gap of the information age.
2007 May 25

Moving to a new server.
2007 May 04

Preparing an application for distribution.
2007 May 01

Spreadsheet::ParseExcel is looking for a maintainer.
2007 Apr 28

CPAN Modules in Linux Distributions.
2007 Apr 18

Version control of single files using Subversion.
2007 Apr 13

Testing results, Perl and CPAN module availability.
2006 Aug 05

Perltraining.org split into two.
2006 Jul 23

Upgrading Ubuntu to 6.06, (Dapper Drake).
2006 Jul 22

Ginger Spam Salad.
2006 Jul 20

Automating the blog.
2006 Jul 19

Wish list: search engine for Perl related sites.
2006 Jul 19

Perltraining.org .
2006 Jul 19

More blog related issues.
2006 Jul 19

Starting a blog.

 

Strawberry Perl for Windows

Thu Apr 3 22:03:15 2008

For a long time I negletcted this project but today I create a fresh VMware image of Windows XP and installed Strawberry Perl on it. I was surprised to see how nice it is! It already comes with a pre-configured CPAN-shell and everything else you need to compile modules that use C. You don't even have to setup your CPAN mirror as they already preconfigured one for you.

I am about to show Win32::GuiTest in class. I know it works well on ActivePerl but there you get a binary version of it. I wanted to see how does it work on Strawberry Perl. It works. Great.

Then I also wanted to try Win32::GUIRobot as that is supposed to be a superset of Win32::GuiTest. Unfortunately one of its dependencies Prima did not install easily. I had to run Makefile.PL manually. After some fighting I managed to install that too so I hope I'll be able to play around with it. I would not be able to do so in ActivePerl as there is no precompiled version of this module. I have already asked Randy Kobes to prepare one, so by the time you are reading this you might already find one but in the long run I don't want to rely on this.

If you would like to get involved in the work on Strawberry Perl the place you should strat looking at is the Win32 Perl wiki.


Oslo Hackathon day -4

Tue Apr 1 22:03:15 2008

After early wakeup and the flight to Vienna I was happy that though I only had 40 minutes for my connection flight to Oslo but I made it. I even waited a few minutes for the flight.

Not only that, but my luggage also arrived in Oslo where Kai was already waiting for me. After a 30 minutes ride on the train (160 NOK, wow!) we arrived at the central station from where we took a street car (or tram) to the offices of Linpro where my classes are going to be and where the QA Hackathon is going to take place.

There we met Salve and looked around. Very nice facility. I could hook up my computer to the projector immediately but the wireless did not work. As I found out later, it probably helps if I turn it on on my computer ... Tomorrow I'll see if it works in Linpro.

The rooms are nice with lots of light which is usually not that cool with projectors but it is not bright sunny as it is quite clouded now.

After our visit we took the street car back to Hotel Best Western Anker, where I am going to stay. We got a code to be used to hook up the computers to the wifi that Kai and Salve managed immediately with their Windows. I had trouble with Ubuntu but here was that I found out that I need to turn on the wireless in my computer.

OK, I hardly slept 3 hours tonight. I can use this as an excuse.

We had a nice walk around the city with Kai. Salve is preparing himself for some serious diving, so he did not come with us.

The only part where I actually managed to take out my camera was the dinner. I can report the beer is good (but very, I mean very expensive). The food is interesting. We had:

Dinner in Oslo


Blogging about Perl outside the community?

Fri Mar 28 00:23:11 2008

I read the suggestions of chromatic to write about the projects we do and then post them on Technorati and digg.com and similar places. Actually I think I already read these suggestions a few month ago. So I signed up on both Technorati and on digg.com.

Then I looked around to see what content is there which might be related to Perl. One of the first hit on digg.com was the link to the Perlmonks node The Perl Hacker Inferiority Complex

I read the comments and it was plain sad. Full of nonsense coming out mainly from people who seem to be Python programmers. Lots of hatred too.

Do I really need this? Even on Perlmonks a few month ago there was a troll who posted stupid and offending comments to nearly any post or comment. After some time it went away but it was very annoying.

I would not be surprised if many Perl programmers would rather not post anything on these forums just to avoid such comments. I for one get quite discouraged.

Anyway I posted another Perlmonks node on digg.com: What can bring the excitement back to Perl and an article on PerlBuzz: Good Perl code is the best form of evangelism

We'll see if generates the same stupid reaction.


OSCON Proposals rejected

Thu Mar 27 12:45:57 2008

All three of my OSCON talk proposals were rejected. I was quite disappointed. This is not the first time I submitted proposals and I already felt it is waste of time as it is not likely they will accept. I only submitted as a friend who was there last year encouraged me telling I am much better speaker than some of those who were in OSCON.

So its quite discouraging to be rejeceted again. Anyway as I can see Ovid got similar answers and he is way better than I am and his mother tounge is English so even that could not be an obstacle.

So I'll keep attending YAPCs in Europe. I might even visit YAPC::NA thought it is not likely. I'll see how the training in Oslo next week is going to work out and if it successful - that both the students like it and I get paid - then I should try to offer similar classes in other places in Europe as well.


Preparing for the QA Hackathon in Oslo

Wed Mar 26 20:57:15 2008

So in less than a week, on the 1st April I am flying to Oslo for the QA Hackathon which takes place between 5-7 April. In addition to the Hackathon, I am also going to teach a training class called QA Automation using Perl which will be held between 2-4 April.

Ever since we agreed to this trainnig class with the organizers I have been working on my materials. I had plenty of plans on how to improve my slides and this seemed like a good opportunity to implement them. Well, at least some of them.

I have also heard from other Perl trainers but it seems to be true for me as well. You need to invest about 8 hours of development time in one hour of real training. I usually don't have such a huge investment up-front but then after every class I invest more time in improving my slides.

I added at least 2 more chapters this time, clean up a lot of my examples, added some exercises and I am still not done. Anyway, soon I'll have to wrap it up.

After the course I am going to join some of the most central people in the Perl world who create many of the tools I am teaching in my class. There are many plans. I hope to find some people who will help me work on my pet projects too.

I'd be glad to work on CPANTS with Thomas Klausner as I think it can help a lot improving the general quality of the Perl modules. Then there is the CPAN::Porters issue, especially collecting the statistics from the various distros can have a good impact on the ease of use of Perl.

So I am quite excited about the coming week.


Missing licenses on CPAN modules?

Tue Mar 25 11:21:47 2008

After I posted the above note (License of Perl Modules on CPAN) on the module-authors mailing list I got a quck reply from David Landgren telling me that it has been there for several years now.

Wow. If that's true, and I checked in 6.31, the oldest verstion of MakeMaker currently available of CPAN and it was already in the docs back in October 2006, then why are there still so many modules on CPAN without a proper license field in theire META.yml file?

CPANTS sais there are currently 9920 distributions without a license field in the META.yml file. (Out of the 13222 or so distributions.)


License of Perl Modules on CPAN

Mon Mar 24 23:22:31 2008

When looking at search.cpan.org one might notice that many of the modules have Unknown License. Actually most of those modules do have copyright and license information in some of its files but search.cpan.org takes this information from the META.yml file that comes with the module.

In modules uploaded many years ago there is no META.yml at all as this is a relatively new addition (a few years old). In addition ExtUtils::MakeMaker, the older one of the two major packaging systems of CPAN has not supported this field. Until recently.

I have just noticed when playing with ack that if you add the LICENSE field to your Makefile.PL and if you use a recent version of MakeMaker (I am using 6.42) then it will add the license field to META.yml.

That's great news as this will soon increase the number of modules that supply the license field. We just have to make sure module authors know about this.

Followup: Missing licenses on CPAN modules?


Joining Technorati?

Mon Dec 24 11:36:29 2007

OK so I am new to the Internet...

It is clear I am far from being an alpha geek. Maybe an Omega geek. Anyway I signed up to Technorati and added my blog. Now you just need to add it to the Add to Technorati Favorites and it might help get the word out.

Does the word neet to get out anyway?

Technorati Profile


Regular Expressions in Perl 5.10

Mon Dec 24 11:36:28 2007

There are many new features in the regular expression engine of Perl 5.10. I point out some of them.

Named captures

I am trying to match a phone number and save the values in variables.

One way to do it is:

   if ($str =~ /^(\d+)-(\d+)-(\d+)$/) {
      $num{country} = $1;
      $num{area}    = $2;
      $num{phone}   = $3;
   }

The new way is

   if ($str =~ /^(?<country>\d+)-(?<area>\d+)-(?<phone>\d+)$/) {
      %num = %+;
   }

Starting from 5.10 we can name the capturing parenthesis and the strings they match will be in the %+ hash using the names of the parenthesis as the keys.

Not only that but we can use these names also instead of the \1, \2 matching buffers y writing \k as in the following example:

/(?<letters>[a-z]+)-(?<digits>\d+)-\k<letters>-\k<digits>/

Using names will make it much clearer what each pair of parenhesis are matching and will eliminate bugs created when we add or remove a pair that changes the numbering.

For example in this regex:

/(.)(.)\2\1/

If I want to add a repetition to it I would start writing

/((.)(.)\2\1){2}/

but this is incorrect and gives a syntax error as now I need to change the numbers of the buffers:

/((.)(.)\3\2){2}/

Using named buffers even if they are just single letter will solve this problem:

/(?<c>(?<a>.)(?<b>.)\k<a>\k<b>)/


Switching in Perl 5.10

Mon Dec 24 11:31:28 2007

One of the complaints about Perl was always that it lacks a real case or switch statement. While you could always fake one, people were not satisfied. Of course if you give them a switch statement they will find something else....

So in accordance with the Perl 6 design perl will NOT have a case or switch. It will have a given keyword. It will also behave differently than the usual case. It will do The Right Thing (tm).

The syntax is quite simple:

given($value) {
    when(3) { say "Three"; }
    when(7) { say "Seven"; }
    when(9) { say "Nine"; }
    default { say "None of the expected values"; }
}

We are taking the value in $value and comparing it to the values within the when() statements. When we find one that matches, the block after the when() is executed AND the given statement is terminated. That is, no more when() is checked.
If non of the when() cases fit then the (optional) default {} block is executed.

Let's see another example:

given($value) {
    when(/^\d+$/)            { say "digits only"; }
    when(/^\w+$/)            { say "Word characters"; }
    when(/^[a-zA-Z0-9.-]+$/) { say "Domain namish"; }
    default { say "None of the expected"; }
}

It is very similar but now we have regular expressions instead of fixed values in the when() statement. Each regex on its turned is tried against the value. When one of them matches its block is executed and the given() statement is terminated.

Yes, what you are suspecting is right. The when() statements are actually applying ~~, the smart match operator.

I have already written about it earlier in Smart Matching in Perl 5.10. So you can use any kind of value in the when() statement. A number will check numeric equality using ==, a string will use eq, a regex will try to match the given value and if you supply a subroutine reference then Perl will call that subroutine using the given value as a parameter and check the true-ness of the return value.

See this example:

given($value) {
    when(10) {
        say "Number 10";
    }
    when([11, 23, 48]) {
        say "In the list";
    }
    when(/^\d+$/) {
        say "digits only";
    }
    when(\&is_number) {
        say "Is number";
    }
    default {
        say "None of the above";
    }
}

sub is_number {
    return $_[0] =~ /\d/ and $_[0] =~ /^[+-]?\d*\.\d*$/;
}


There are few more minor issues:

Perl will automatically break out from the given() statement after the execution of block. If you would like to force checking the additional when() statements use the continue keyword.

On the other hand if you would like to break out from a given() statement before reaching the end of the when() block, you can use the break statement yourself.

The given() actually assigns the $value to $_ so you can use that as well to write when clauses such as this:

when($_ < 18) { say "Less than 18"; }

when() can be used outside the given() block as well.

For further details see the documentation of the Switch statements.


Last Update: Tue Sep 25 17:06:26 2007