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++ }
Foo::showit;
Bar::showit;
Foo::incit;
Foo::showit;
Bar::incit;
Bar::showit;
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.
@Pedro and @Tom: $foo is redeclared. How do the first Foo::showit know that it's binding to a variable which doesn't exist any more? It's bound to the address of the first variable (not the name), even though that variable is gone (replaced by the second declaration). Devel::Peek shows a refcount of 3 and that's why the first $foo hangs around.
This could lead to interesting obfuscations where we have the variable $x declared 30 times and yet is always a different $x.
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
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?)