I've uploaded my Mastering Perl slides to the OSCON website.

I've uploaded my Mastering Perl tutorial slides to the OSCON website.

Introducing Catechesis

I love testing. I like to know, to the greatest degree manageable, that the code I have written does what I think it does. I love testing in Perl because there's a selection of tools available which is broad and deep. I wish the implementors of other languages would take a look at the Test:: and Devel:: sections of the CPAN and steal some ideas, really.

Recently I found myself designing a message-passing framework, and I decided that I wanted to at least have Perl 5, ObjC, Python, and Javascript implementations. The arguable sanity and hubris of this aside, it brought up an interesting problem in the domain of testing.

Monthly Meeting Report Of July

Yesterday, on Monday 19th of July we had our reoccuring Perl-mongers group meeting. Due to refurbishment we went to a different restaurant this time.

We were eight Perl programmers and every one of them primarly declared their participation on Doodle. Yes, we use Doodle to coordinate our meetings but we came up with the idea of implementing an online planner software by our self. Maybe this is the project one of us needed to get started with mojolicious.

We also spoke about who is going to YAPC, who is arriving when, and in which hotel do our fellow mongers stay. We also made some kind of plans for the 3rd of August when some of us want to do some site seeing in the afternoon until the preconference meeting starts. Maybe You want to come along with us to, we are looking forward to meet you.

And we also did some jibba jabba about our personal lifes, about physics, mechanics and electronics and other stuff more or less far from Perl. And we had quite some fun and a good meal.

Using magic hash key transformation

Since version 5.10, perl has the ability to magically transform keys on a hash. This feature was added to make fieldhashes possible, but has more uses. Here I'll show you how to do in using Class::Private as an example.

Loading the XS

package Class::Private;

use 5.010;
use strict;
use warnings;
use XSLoader;

our $VERSION = '0.05';

XSLoader::load('Class::Private', $VERSION);

1;

As you can see, there's not much to the Perl part of this module, it loads some pragma's (the 5.010 is important because this feature will not work on older versions) and then loads the XS.

Casting the magic

SV* new(class) SV* class; CODE: HV* hash = newHV(); sv_magic((SV*)hash, NULL, PERL_MAGIC_uvar, (const char*)&hash_filter, sizeof hash_filter); RETVAL = sv_bless(newRV_noinc((SV*)hash), gv_stashsv(class, GV_ADD)); OUTPUT: RETVAL

The joys of backtracking

I'm pleased to say that Parrotlog is now at a point where it can actually do stuff. It can call predicates and backtrack (more on that in a moment). Unification probably works as well.

Now, backtracking is tricky to get right. Currently Parrotlog has a problem with cuts. A cut is supposed to remove all choice points encountered after the currently executing predicate was invoked. Parrotlog's cut prunes all choice points since the invocation of the last predicate that matched successfully. Close, but no cigar.

YAPC::NA 2010 Survey : Final Week

For the last few weeks the YAPC::NA surveys have been running. In that time we've had received a total of 94 Conference Surveys submissions and 431 Talk & Tutorial Evaluations. While that is certainly a great response, we'd like more. Out of 298 attendees, that's only 31% of possible responses, while last year we managed 45%. So, if you haven't responded so far, please think about doing so. A mail has gone out to all those attendees who haven't responded yet, containing their personal keycode login, so please check your spam filters if you haven't received it. If can't find a copy of the email, and you definitely attended YAPC::NA in Columbus, please contact me directly (barbie [at] cpan.org).

Check SSH keys on your VPS

Today, during a routine check of a new server, a co-worker found an authorized_keys file that isn't ours. The keys in the file (two of them) were of the VPS company that provided the server. One of them is of a specific user there and the other is a generic one.

This grants them password-less access to our server. We have no idea if the private keys are shared between people and whether they are even password protected or not. If they aren't password protected and shared between users (which is likely), it means that we have a completely unknown number of people who can seamlessly access our server and if the key is stolen or ill-gotten somehow, it's much much worse.

Promoting Perl is fun

A year and a half ago, on the private mailing list of the White Camel recipients I was accused that I am trying to promote myself by promoting the White Camel award, that I am trying to turn it into a cheap marketing trick. It was done by someone I very much appreciated.

A few weeks ago, I was accused that I want to tax the funds of the Perl community.

Then in a private, "conversation" on IRC I was compared to some female body parts because I was "attacking" the above person. Apparently that happened, when I wrote that his words were offending me.

Most recently I have been accused that I am trying to use the Perl community to promote my business.

After every such event I spend hours, days, and sometimes even weeks wondering: Are they the few speaking the opinion of the majority? Is this what the Perl community thinks about me and my actions? If not, then why do I get these?

It takes ages to get in balance again.

Luckily there are many people who support the things I have been doing and express their support privately or publicly.
Thank you!

Thoughts on a Ctypes::Type object API

For the past few days I've been considering and experimenting with the design of simple Ctypes::Type objects. These are objects which, funnily enough, represent C data types for manipulation in Perl.

The reference implementation

Looking at the Python ctypes module, there were various things I didn't like. Python's simple types [0] can be summarized thusly:

>>> i = c_int(42)
>>> print i
c_long(42)
>>> print i.value
42
>>> i.value = -99
>>> print i.value
-99
>>>

Having to specify i.value seemed cumbersome for an object which essentially represents just that value and some rules for what kinds of values it can contain. So I started trying various things with tie'ing and overloading. Indeed, I was about to start a fourth project branch on types [1] before reigning in and having another think about fundamental behaviour.



Metaphor clash

Parallel programming with fork() and tail()ing logs

I' ve worked on a small freelance project recently. It was a log watcher and another tiny program watching it (watcher watcher). Basically, it's an extended `tail -f` watching over multiple logs generated by some persistent programs simultaneously and sending alerts based on configuration data. So there are two main problems before starting coding:

  1. Use threads or use fork()?
  2. Hand craft tailing code or check if there is already a module for that?

Kephra under Linux

Because of technical problems I was stuck to xp but recently using more and more my ubuntu boot partition. That was the main reason it was not on top of my priority list to to fix the remaining problems Kephra had. But finally, 0.4.2.33 is the first version that installs like a breeze. Of course its a dev release but a stable/testing release will come soon (1 blocker left).

But when you run Kephra, you will get a bag of GTK errors. That's not because i can't code. It's because i was too quick. I thought of features that in the end GTK considers as bugs. So i will rethink the autogenerated menu builder - event table - bridge. I have to do it anyway to speed up the pop velocitiy of the main menu under windows and to finalize some parts of the upcoming plugin API. But for now you can safely ignore the warnings, they're harmless. It should be also work for mac, but it's not tested, yet. (any volunteers? :) )

Put up or Shutup, part 1: Starting somewhere

My ranting and raving from the previous post, which I expected to only receive shun, flame and troll turned out to have a positive side effect: being told to actually do something about the things I was complaining about. So instead of disappearing into /dev/null or somewhere equally as stupid, and despite my own inabilities to do them all, the least I can do is something which is greater than being a clown on the internet.

The things I bitched about boil down to a few key bits:
  • Usability and experience on Perl related websites need significant improvement
  • Monitoring the effectiveness of the usability and reach along and iterating changes on the websites to improve usability for new comers and regular users
  • A greater effort to aggregate and supply high quality recordings of talks and screen casts.

Firefox/Chrome/Safari - Beautiful Examples of Objects

You may not have heard of Ralph Johnson and Joe Armstong, but they've been programming longer than most of us have, including OO programming longer than most of us have. It's fair to say that after you've been doing something a while, you tend to form opinions about it. Mssrs. Johnson and Armstrong have opinions and this interview with Ralph Johnson and Joe Armstrong is full of said opinions. It's brilliant. There's a great bit from Joe Armstrong where he explains what he thinks "OO" should be about. Though he doesn't use the Web browser as an example, I will. But first, it's important to quote him at length.

Albany.pm - Capdist, NY Perl Mongers meeting

There will be a Albany, NY Perl Mongers meeting the last week of July 2010 to get things rolling again after a very long hiatus. Sign up on the mailing list, or stop by on irc (irc.perl.org / #albany.pm) to find out more details!

Callbacks done, weird 64bit libffi issue?

The week has been frustrating, funny, yet ultimately fruitful.

Research, enhancing C function signatures

I had callbacks to Perl almost working at the start of the week, but couldn't seem to get variables updated 'in place'. The example function I was using to test callbacks, the C standard qsort, takes as its arguments a pointer to an array, the number of items in the array, the size in bytes of one item, and a reference to a function which will be passed two items from the array at a time and decide how to sort them. It returns void, and the original array ends up sorted.

I had the arguments passing to Perl and returning all right, but couldn't see how to update the array itself, so I spent a long time reading the C source for Python's ctypes to try and figure where or how it did so. I learned a lot, about Python internals in general and about its ctypes implementation.

The "M" word is the wrong word.

If you are offended, angered or feel I am mistaken, I welcome dialogue on this topic. No doubt what I will say might piss someone off.

BETA - An Example (of Failure)

The BETA project started in 1976, briefly escaped into the real world and was quickly beaten to death only to have its corpse revived in academia. It's one of quite a few languages which seems destined to never catch on. It's kind of a shame as it's an interesting language, but I'm certainly in no position to change this and, in any event, am not certain I would want to.

Yesterday I posted an example of OO in BETA. Prior to that, I posted an interesting quote from the BETA researchers. In the quote, they talked about how BETA was for modelling and they didn't like inheritance for code reuse. BETA is all about modelling things properly. They talk about this a lot.

Yet Another Perl 6 Logo

I recently saw Sebastian Riedel's designs for Perl logos, which I like quite a lot, and it reminded me of some of my own ideas in this area.

When the Camelia logo came out I created a few designs for a variation on the butterfly logo based on twin infinities. I don't really have the skill to render them as artistically or as polished as I would wish but the basic idea was something like the following:

Perl6_inifinities_01.jpg

Or with the lower half smaller to emphasise the butterfly shape:

Perl6_inifinities_02.jpg

Or with rotation:

Perl6_inifinities_03.jpg

If you like this idea and have some artistic flair maybe you could create some more colourful and or polished variations on this theme.

iCPAN: CPAN on your iPhone

When I've got a few minutes here and there, I like to browse the CPAN for new, interesting modules. I wanted a way to do this quickly and easily on my iPhone, without needing to get online to do it. This app did not exist, so @ioncache and I set about creating it. iCPAN has been available in the Apple app store for about 4 weeks now and we're currently working on updates for the next version. (Our lightning talk slides have now been posted as well.)

iCPAN works on your iPhone, iPod and even your iPad. Our initial release of the app allows you to:

  • search CPAN documentation by module name
  • bookmark your favourite modules
  • view your recent searches
  • browse the docs offline


The next release will add the following:

  • Example code snippets in docs will be formatted via PerlTidy
  • These codes snippets will also feature syntax highlighting

one liner history command counter

Wondering what commands you use the most, try this one liner:

$ history | perl -ne 'END { map {print ++$i.": $_\n";} splice(@{[sort {$h{$b}<=>$h{$a}} (keys %h)]},0,5); } m/\s+\d+\s+(.*)/; $h{$1}++;'

In one of the servers I use I got:

1: ls
2: fg
3: cd ..
4: sudo tail -f /var/log/httpd/error_log
5: cd


Well, I actually added:

alias j=jobs
alias vl='sudo tail -f /var/log/httpd/error_log'


To my .bashrc after this.

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.