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.
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:
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.
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.
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.
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.)
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.
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.
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:
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:
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.