List::Util, List::MoreUtils, Util::Any (Unfortunately, Part 1)

The dichotomy of List::Util and List::MoreUtils is one of the unfortunate annoyances in Perl. One is without s, one is with s. Which function belongs to which? And no, you can't simply say, "f*ck it, just import everything!" as List::Util doesn't provide the usual ":all" import tag (RT).

Some thoughts (from someone who is largely ignorant on the history of both modules), all IMO:

1. Since List::Util is basically a convenient library, convenience should've been its main design goal. It should've been inclusive enough. The decision to deny the inclusion of any(), all(), none() just because they are too "trivial" to implement in one line of Perl was a bit strange, since max(), min(), etc are also trivial to implement in Perl.

2. List::MoreUtils should've included all the functionalities of List::Util, so one can use it *instead of* List::Util.

But hey, what happened happened.

Btw, we also have Perl 6's junction taking the "all", "any", "none" keyword.

DB::Pluggable::Dumper on Github and CPAN

I recently blogged about extending the Perl debugger. Basically, if you use xx $some_var, you get love Data::Dumper output instead of the confusing debugger output:

Is that perl 5.12 on your netbook?

OH YEAH!

Just finished installing the brand spanking new Perl 5.12 on the netbook on my "perl" account, with which I tested already earlier -RC releases with my personal code.

It's fair to say that the user experience has gone a long way from the "old days" of manual configuration, installation, swearing and $ENV madness. Hell, one doesn't even need local::lib anymore!

All I had to do to test 5.12 after creating my "perl" account was:

Forcing updates?

Today Perl 5.12.0 saw the light of the day. It includes some cool features. For example, to define package versions on the package keyword is great. But these new features (including in the same bag the new features from 5.10) make me discuss with myself about their use or not.

Just when I'm warming to 5.10, comes 5.12!

Perl is far from dead/dying nowadays, with 5.12 being released recently, and the yearly timed-based release plan and all. In fact, just after I start to be comfortable using some of the 5.10 niceties, here comes a whole new version with even more niceties waiting to be explored!

Features in 5.10 I'm using regularly.

Defined-or (if there's only one feature I can have in 5.10, I pick this one).

State variables (love it!).

Features in 5.10 I'm starting to use.

-E switch (but my reflex still says -e all the time).

Recursive pattern in regex (e.g., via Regexp::Grammars).

say() (maybe if I say it often enough I'll start to say say more).

Features in 5.10 I rarely/ever touch.

Smart match (I know it's a godsend, but strangely I never feel the need for it so far).

given/when (I'm sticking with if/elsif/else, especially since given/when cannot be used as an expression yet).

Perl Five is Alive

Perl 5 core development was in a downward spiral for a couple of years. Releases happened less and less frequently, the number of contributors dropped and the general outlook was getting worse and worse. For the Perl 5.12 release I wrote a post on the ActiveState blog how the downward trend has been reversed and how fun, optimism and even excitement has returned to Perl 5 language development.

Conditional TODO Tests

There are some tests which pass, but routinely fail in the debugger. Here's one example:

2010 Vienna QA Workshop, final summary video

This is the video from the final stand-up on everyone's progress for the entire 2010 Vienna Perl QA Workshop.

Data::Dump::PHP

I actually don't believe there isn't something like this in CPAN yet. Well, actually there is PHP::Var, but it has bugs, doesn't handle scalars, and doesn't do recursive structure. But then I am equally surprised to be able to hack Data::Dump::PHP in just a couple of hours, by blatantly copying from Gisle Aas' Data::Dump and just modifying only what's necessary.

And another note, PHP's var_export() currently can't dump recursive structures, which Data::Dump::PHP can.

Get the damned version

Module versions can be found using several ways. I know two.

You can use the module in a one liner and print the module's $VERSION variable:
perl -MSVG -le'print $SVG::VERSION'

This gets annoying when the module name gets long:
perl -MWWW::Mechanize -le'print $WWW::Mechanize::VERSION'

Or the insane:
perl -MPOE::Component::WWW::Pastebin::Bot::Pastebot::Create -le'print $POE::Component::WWW::Pastebin::Bot::Pastebot::Create::VERSION'

Another method I've seen people use is to actually cause an error. Try to load the module in a high version that doesn't exist. The error will show what version it is:
perl -MWWW::Mechanize\ 9999
perl -MPOE::Component::WWW::PasteBin::Bot::Pastebot::Create\ 9999

This is pretty good, since it's short to write and most likely you won't find many versions above 9999 (except perhaps, File::Slurp - last version 9999.13). However, this is a bit confusing to newbies, trying to cause an error on purpose to simply find the version.

Moreover, since it causes a compilation error, you can't easily check multiple versions.

Perl QA Hackthon Day 1

For various reasons I was only able to attend a few hours in the moring, and all of that time was spent organising stuff (even though most of the organising is done by daxim and pst). At least I took some photos:

Perl QA Hackathon 2010 - Happy Hacking

Perl QA Hackathon 2010 - More Happy Hacking

In the evening I joined the rest of the attendees again at Der Wiener Deewan for delicious pakistani food, sponsored by 123people.

The perl repository goes all the way back to Perl 1

I had been looking around for the ancient Perl sources to add to my collection, but Schwern told me that they are already in the Perl git repository. I just have to checkout the correct tag:

$ git tag -l
perl-1.0
perl-1.0.15
perl-1.0.16
perl-2.0
perl-2.001
perl-3.000
perl-3.044
perl-4.0.00
perl-4.0.36

Now I just need to get these to compile on my MacBook Air.

I've suggested that Schwern needs to make a git archive of the internets now.

Parrotlog - Parsing Prolog

For the syntax and semantics of Prolog, Parrotlog is based on a draft of the ISO/IEC Prolog standard (seeing how the actual standard costs muchos dineros).

Now, the good news are that the Prolog spec is actually an operator precedence grammar, which happens to be how NQP does its expression parsing as well. The bad news are that the spec uses term for everything, while NQP makes a distinction between terms (atomic expressions) and expressions (expressions, with or without operators). This means that I have to figure out if I should use term or EXPR whenever the spec says term. Let's see how deep the rabbit hole is.

Test::Class Tags

A few folks have talked about adding tags to Test::Class. This would allow us to do things like load 'customer' fixtures if something is tagged 'customer', or only run tests tagged 'model'.

Here's what I have working now:

Fixing connect (git via proxy) and debugging it

I tried connecting to github again via our strict firewall and http_proxy, which only allows 443 and 80.
corkscrew and simplier proxy tools do not work, and my machine which has 443 redirector had a harddisc crash, so I fixed connect by Shun-ichi Goto
at http://www.taiyo.co.jp/~gotoh/ssh/connect.c
See http://www.taiyo.co.jp/~gotoh/ssh/connect.html

Our squid balances between several session servers so I needed to add realm support.
That was easy. See http://gist.github.com/360940

.ssh/config: =================
ProxyCommand connect -d -d -H proxy:8080 %h %p Host github.com User rurban Port 22 Hostname github.com IdentityFile ~/.ssh/proxy TCPKeepAlive yes IdentitiesOnly yes

Host ssh.github.com
User rurban
Port 443
Hostname ssh.github.com
IdentityFile ~/.ssh/proxy1
TCPKeepAlive yes
IdentitiesOnly yes


================= Reading from a http: url works now over the proxy. .git/config:
[remote "origin"] fetch = +refs/heads/*:refs/remotes/origin/* url = http://github.com/mirrors/perl.git
But still no luck for writing via port 22 i.e.

2010 Vienna QA Workshop, Day 2 results video

This is the video from the morning stand-up on everyone's progress for the second day of the 2010 Vienna Perl QA Workshop.

oe1.orf.at relaunch done

The new and shiny oe1.orf.at is finally online!

As you might expect it's crafted using the finest ingredients of Modern Perl: Catalyst, DBIx::Class, Moose, HTML::FormHandler, KinoSearch. Relaunching the site was a nice project, even though there were some setbacks:

I was forced to switch from Postgres to MySQL (using - the horrors - MyISAM), so I couldn't use any real database features like transactions and referential integrity; the launch date was postponed a few times, so I couldn't help organising the QA Hackathon as much as I wanted (in fact I can also not attend all days, because I want to spend some time with my family before leaving for Berlin / Icleand).

Anyway, after fixing some last post-deployment glitches everything seems to work now. Yay!

Vienna Perl-QA Hackathon, Day 3

Last day of the hackathon and things are going well. We're doing enough yak-shaving that I think it should be called a Yakathon, but that's a separate issue.

CPAN Testers Summary - March 2010 - Fragile

March has been a very busy time. Although we weren't able to meet the 1st March deadline, the switch to the HTTP submission process has started. Currently it's still considered Beta, but initial problems appear to have been worked out, and the Metabase is receiving reports thick and fast. So much so that some testers started to ramp up their smoker bots again, forgetting that some were still submitting SMTP reports. You can read David Golden's report of his beta test update.

What could a completely different CPAN client do?

I'm about to leave for Vienna for the 2010 Perl QA Workshop, so now it's time to start thinking about my secret project. I've saved it especially for something to do on the plane.

A couple months ago, David Golden and I got together to talk about what a new CPAN.pm client would look like. Now, remember that both of us have our noses deep in the CPAN.pm source, and both of us have thought, on several occasions, that we should refactor CPAN.pm. Gabor, who is also going to be in Vienna, even went so far as to separate each package into its own file back in October 2008.

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.