Miscellaneous Thoughts

Though 1: Test::Class::Most fails on Perl 5.010001 -- but only on Linux. Not on FreeBSD, OS X or Solaris. I've already emailed the testers and hopefully someone can track down what's going on. I don't want to say "bug in Perl", but this is not platform-specific code, so it looks suspicious.

Thought 2: Can anyone please explain to me why anyone would want to buy a whyPad?

Thought 3: What does the following print and why? Results are the same for 5.10.1 and 5.8.9, in case you're wondering. Try and figure out the output before you run the code. I now know why it does this, but I was confused by the behavior.

#!/usr/bin/env perl -l

use strict;
use warnings;

my $foo = 3;
sub Foo::showit { print $foo }
sub Foo::incit { $foo++ }
my $foo = 10;
sub Bar::showit { print $foo }
sub Bar::incit { $foo++ }



A co-worker told me he would might buy it to read his ebooks on the train on the way to work and back, if it helps.

About 2: I'm thinking about buying and iPad because I will be able to leave the laptop at home, one less thing to cary on my short trips. I will only need the laptop with me (its a 17", so 2.5kg) on work trips.

For most common day-to-day tasks not work related, the iPad *seems* enough.

About 3: I got what I expected, no confusion. What was the part that confused you?

(3) didn't confuse me either. Now I'm worried I should have been confused.

OK that's what I thought was happening, although I'd have expected the refcount for the first $foo to be 2 after the second declaration.

This is just the same as

        my $x;
        sub foo { $x }
where &foo has a ref to $x even after its name has gone out of scope.

(How do I post code snippets without double-spacing like that? When will we get a Perl blog site that understands pod in comments?)

Leave a comment

About Ovid

user-pic Have Perl; Will Travel. Freelance Perl/Testing/Agile consultant. Photo by http://www.circle23.com/. Warning: that site is not safe for work. The photographer is a good friend of mine, though, and it's appropriate to credit his work.