Signals in Perl, 5.10.1 vs 5.14.2

A Perl script that I've been working on wasn't working properly with Perl 5.14.2.

It turned out that the problem was really with my use of local signal handlers.

The following code works with 5.10.1 but not with 5.14.2:

#!/usr/bin/perl
use strict;
use warnings;
print "starting pid=$$n";
my $I = 0;
{
  my $pid = 0;
  sub handler {
    my $sig = shift;
    $I += 1;
    print "caught $sign";
    local $SIG{$sig} = 'IGNORE'; # doesn't work with local!!
    kill($sig, -$$);
    print "end of handlern";
  }
  local $SIG{INT} = &handler;
  kill('INT', $$);
}
print "ending I=$In";

With 5.10.1, it calls handler() twice and then exits with I=2; with 5.14.2 it calls the handler many times before crashing with a segfault.

Removing the local from the inner $SIG{$sig} allows it to work with 5.14.2, which makes sense if I'm right in thinking that that command changes the immediately-containing signal handler, and not the global one.

I found the Perl documentation a bit vague on this topic, so this is here in case it's useful to someone else.

Xubuntu 11.10 on Novatech B940 NNB-888 laptop

This was for a client who only needs the basics — email, typing, web browsing — and doesn't have time to adapt to a trendy new GUI.

So I installed Xubuntu 11.10 (I like XFCE).

And it all just worked out of the box — wifi, webcam, sound etc.

Except for sleep and hibernation.  I tried all sorts of fixes and troubleshooting, but nothing worked.  The screen goes blank, but it doesn't turn off.  After being forced off, it resumes as though sleep or hibernation had worked.  Couldn't solve it, so I just changed the settings to never try to sleep or hibernate.

Updating from Ubuntu 9.04 to Xubuntu 11.10

I was working on a client's laptop, on which I'd installed Ubuntu 9.04 a few years ago and it hadn't been updated since then.

I wanted to bring it up to date, and knew that the client wouldn't want the look-and-feel of it to change radically, so to avoid Unity and Gnome 3, I decided to install Xubuntu 11.10.

I backed everything up, expecting to do a clean install of the new system.  But the Xubuntu installer offered to upgrade directly from 9.04, so I tried it, and it worked! 

The only minor glitch was that Thunderbird didn't find the old profile.  I had to rename ~/.mozilla-thunderbird to ~/.thunderbird, and then that worked too.