How do you update your system Perl?

Although I'm an advocate of configuring and installing your own perl while leaving the system perl alone, I'd like to have a list of the various ways particular distros and package managers do it for the system perl.

  1. The package manager program (e.g. yum, apt-get)
  2. The package name(s) to get the standard distribution, including the docs, ExtUtils::MakeMaker, and everything else
  3. Does that package manager allows you to configure, per-package, the installation location.
  4. Discovering module packages (what is the name, version of the module, etc)
  5. Your distro version, if…

Tad McClellan, R.I.P.

Tad McClellan passed away last weekend.

Most Perl people probably Tad from his activity on Usenet, where he was a frequent and helpful presence on comp.lang.perl.*. I worked with him personally when he handled the operations for Stonehenge Consulting, handling the boring business stuff while Randal and I, along with the other Perl trainers, stood in front of rooms of students. Tad was a Perl trainer himself, and some of you may have met…

Painless RSS processing with Mojo

I wasn't looking forward to dealing with this XML feed because I hate anything that deals with XML. However, with Mojo's DOM stuff, I don't even have to know it's XML. Here's the interesting bits from a program that's not much larger than this snippet:

use Mojo::UserAgent;

my $ua = Mojo::UserAgent->new;
my $response = $ua->get( $feed_address )->res;

my @links = $response->
dom( 'item' )->
grep( sub { $_->children( 'title' ) !~ /.../ } )->
map( sub {
$_->
children('guid')->
map( su…

Giving to TPF through Capital One

I'm not begging for money so much as begging other people to beg for money. Well, I'm not even doing that. I just noticed one way that people can give money to a charity.

Generalized single element access

chromatic explained his problem with auto-dereferencing in the hash and array operators, and I said a bit more about it. I missed the right day to post this, but I had a half baked idea about solving the problem.

Basically, the auto-dereferencing, in combination with Perl 5.12 allowing hash operators to extend to arrays, means that part of the problem doesn't care what you have and another part does. When you want to do a single element access, you still have syntax that must denote the reference type. If you have a hash, you need curlies:

foreach my $key ( keys $hash_or_array ) {
     my $value = $hash_or_array->{ $key };
     }

But, if that's an array reference, you need square braces:

foreach my $key ( keys $hash_or_array ) {
     my $value = $hash_or_array->[ $key ];
     }

Get the wrong thing there and your Perl program dies. This sort of thing happens when you solve the easy half of the problem without following it all the way through.

But, who cares? Why don't we have a generalized single element access that doesn't care what sort of aggregate it is? Parens are taken for code references. The remaining ASCII pair is the angle brackets:

foreach my $key ( keys $hash_or_array ) {
     my $value = $hash_or_array->< $key >;
     }

But, we have Unicode source now, so we have lots of paired characters:

     my $value = $hash_or_array->" $key ";

     my $value = $hash_or_array->' $key ';

     my $value = $hash_or_array->« $key »;

     my $value = $hash_or_array->◀ $key ▶;

     my $value = $hash_or_array->▶ $key ◀;

     my $value = $hash_or_array->◤ $key ◢;

     my $value = $hash_or_array->☛ $key ☚;

But, with generalized quoting, we can include subroutines too:

     my $value = $hash_or_array_or_sub->« @keys »

If the subroutine is going to take multiple arguments, we can make this an automatic slice for the aggregates.

But what is the key is itself an array reference? We can auto deref that to get the slice. If it's a hash, we can take the list of keys as the slice indices.

Oh hell, isn't this half of Perl 6 now (and the half that I like)?