I think I finally got logged all the way in to blogs.perl.org. The password thing still seems kind of screwy, but I'm pretty sure it worked this time. I wrote a little entry on my Padre trial and my blog ended up here.
It's December, and that means it's time for Perl Advent calendars!
I love these, I always learn something new!
ETA: Okay, I'm going to list some more here in the main entry (as hanekomu tweeted, "Soon we can have a meta advent calendar where we reveal a Perl advent calendar every day." :)
I installed Perl 5.11 in my home directory, so I could kick the tires a little bit.
wget http://search.cpan.org/CPAN/authors/id/J/JE/JESSE/perl-5.11.0.tar.bz2
sha1sum perl-5.11.0.tar.bz2
# 0d436577386c668161e3dad385d233c383bf4c9d perl-5.11.0.tar.bz2
tar xjf perl-5.11.0.tar.bz2
cd perl-5.11.0
perl Configure -de -Dusedevel -Dprefix=${HOME}/Perl5.11 -Dusethreads
make
make test
make install
I noticed it now has implicit strictures.
$ perl5.11 -le '$foo = "bar"; print $foo'
bar
$ perl5.11 -M5.11.0 -le '$foo = "bar"; print $foo'
Global symbol "$foo" requires explicit package name at -e line 1.
Global symbol "$foo" requires explicit package name at -e line 1.
Execution of -e aborted due to compilation errors.
So if we "use 5.11.0" we get strictures too (I don't know why we get the message twice).
One of the few times we don't want strictures is when we're doing one-liners. We can't use -M5.11.0 to turn on the new features if it also turns on strictures, but that's what we have big -E for.
$ perl5.11 -e '$foo = "bar"; say $foo'
Can't locate object method "say" via package "bar" (perhaps you forgot to load "bar"?) at -e line 1.
$ perl5.11 -Mfeature=say -e '$foo = "bar"; say $foo'
bar
$ perl5.11 -E '$foo = "bar"; say $foo'
bar
Some years ago, I wrote Compress::DAWG, a Perl module for compressing and decompressing lists of words. But I never uploaded it to CPAN, because I didn't think anyone else would find it useful. Slightly more recently, I redid it in Python and rewrote the explanation from the POD on a web page. I've just discovered that neither of these links appears to be indexed by any search engines or, at least, if they are, they aren't ranked high enough to actually show up in any searches. I wonder if I should upload it to CPAN just for posterity? On the one hand, I really doubt anyone else will be interested, but on the other, I hate to see it just disappear.
So the British government has officially apologized for their treatment of Alan Turing and some people seem to think this is too late to do any good. I couldn't disagree more. I think apologies of this sort matter a great deal. Sure, Turing is dead. We can't undo what happened. But there's no benefit in ignoring it. When our governments can be open and honest about things--- including when they screwed up--- I think we're all better off. I'm not British, but if I were, I'd be proud of my government right now. This is not some casual remark. It's an official statement from the Prime Minister. And that statement says everything beautifully while not pulling any punches. We're sorry.
Sorry, this entry doesn't have anything to do with Perl, but Turing is one of the most important figures in the history of computing, so I'm using my "computer blog" to talk about it.

I'm still on the fence about whether I like constructors that throw exceptions. In object-oriented Perl, we seem to have a number of paradigms. Some constructors don't do any error checking, so we always get an object back.
$ perl -MData::Dumper -MImage::Magick -E '$i=Image::Magick->new; say Dumper($i)'
$VAR1 = bless( [], 'Image::Magick' );
$ perl -MData::Dumper -MImage::Magick -E '$i=Image::Magick->new(no_such_attribute
=> "what garbage"); say Dumper($i)'
$VAR1 = bless( [], 'Image::Magick' );
Others return undef on failure and set errno.
$ perl -MIO::File -E '$iof = IO::File->new("rofile", "w") or die $!; say "DONE"'
Permission denied at -e line 1.
I'm most comfortable with these right now, but if you fail to check that return value, they lie to you.
$ perl -MIO::File -E '$iof = IO::File->new("rofile", "w"); say "DONE"'
DONE
Still others return undef on failure, but set some other value instead of errno.
$ perl -MText::CSV -e '$i = Text::CSV->new({binar => 1}) or die scalar
Text::CSV::error_diag'
Unknown attribute 'binar' at -e line 1.
In addition to lying to you if you forget to check the return value, these lie to you if you forget and use errno
$ perl -MText::CSV -e '$i = Text::CSV->new({binar => 1}) or die $!'
No such file or directory at -e line 1.
Gah! That wasn't the problem at all. This particular one also gives you a bit of a mess if you use it as documented
$ perl -MText::CSV -e '$i = Text::CSV->new({binar => 1}) or die
Text::CSV::error_diag'
1000Unknown attribute 'binar'0 at -e line 1.
Since die called it in list context, it gives back more than just the error string.
Finally, the Modern Perl modules throw an exception instead of returning undef. Thus we don't have to check the return value at all.
$ perl -MDateTime -E '$d = DateTime->new; say "DONE"'
Mandatory parameter 'year' missing in call to DateTime::new
at /usr/local/lib/perl/5.10.0/DateTime.pm line 171
DateTime::new(undef) called at -e line 1
However, we now need to eval the call to the constructor, if we want to do anything other than exit.
$ perl -MDateTime -E 'my $d = eval {DateTime->new} or warn $@; say "DONE"'
Mandatory parameter 'year' missing in call to DateTime::new
at /usr/local/lib/perl/5.10.0/DateTime.pm line 171
DateTime::new(undef) called at -e line 1
eval {...} called at -e line 1
DONE
As I said, I'm most comfortable with ones like IO::File now, but DateTime is one of my favorite modules, so I guess exceptions are starting to rub off on me. However, since I use all of the above modules, I'm going to need to be aware of all of the paradigms for some time.
-- oylenshpeegul
So, I guess the little man icons are working now. Here's mine

I didn't think about how to add it to a vox profile or anything. Maybe I'll just have to remember to add it to posts. Hm, but then it will change. I sort of want a static version for individual posts and one that changes for my vox profile. Or something.
It's easy enough to point to the static images, if you know what level you are




I wasn't able to figure out how to use an img tag on my vox profile.
I couldn't figure out how to leave a comment on tokuhirom's blog (maybe I need to learn Japanese...or maybe I just need an account on Hatena), so I'll just make a comment here.
In Perl 5.10, we have a new keyword state for this (we also have our own say), so the following would also work.
use 5.010;
use strict;
use warnings;
sub counter {
state $i;
return $i++;
}
say counter() for 1..5;
No need for an enclosing block or risky behavior.
Okay, to heck with the release candidates...Perl 5.10.1 has been released (today is my birthday...what an ossum birthday present)!
wget http://www.cpan.org/modules/by-authors/id/D/DA/DAPM/perl-5.10.1.tar.bz2
tar xjf perl-5.10.1.tar.bz2
cd perl-5.10.1
perl Configure -de -Dprefix=${HOME}/local -Dusethreads
make
make test
make install
Now let's see if I can get all the Modern Perl modules I want to use installed from source. I've been using the Perl 5.10.0 that's in /usr/bin/perl with a mixture of modules loaded with apt-get and cpanp. I don't want to wait for Ubuntu to upgrade to Perl 5.10.1, so I'll have to do without the apt-get option. It's probably just as well. In the long run, that mixed configuration was probably trouble anyway.
I built Perl 5.10.1 RC2 the other day, but I forgot to enable threads. So I went back to my build directory and re-ran
perl Configure -de -Dprefix=${HOME}/local -Dusethreads
make
make test
make install
That appeared to work fine--- it recompiled a bunch of stuff and there were no complaints--- but the resulting executable was not thread-aware.
$ $HOME/local/bin/perl -Mthreads -e 1
This Perl not built to support threads
Compilation failed in require.
BEGIN failed--compilation aborted.
So I started over in a fresh directory
wget http://search.cpan.org/CPAN/authors/id/D/DA/DAPM/perl-5.10.1-RC2.tar.gz
tar xzf perl-5.10.1-RC2.tar.gz
cd perl-5.10.1-RC2
perl Configure -de -Dprefix=${HOME}/local -Dusethreads
make
make test
make install
and then all was well.
$ $HOME/local/bin/perl -Mthreads -e 1
$
Lesson learned: don't try to reconfigure...just redo it.