Which code to read?

Peter Seibel has written a great blog post on code reading - learning more about programming by reading good examples. The final model he describes has someone diving into a piece of code like a 19th century explorer and then reporting back to the group on what they found. This sounds like a valuable activity for a Perl Mongers group.

So my question to you is what CPAN module would you recommend as rewarding to an intrepid code explorer; and why? Of course I'm not suggesting Perl programmers should only read Perl code, but I do …

Another time-tracking post

Following Steven Haryanto's post on how he tracks his time, I thought some people might be interested in the time tracking solution I'm currently using.

My colleagues and I are required to track our daily activities for billing purposes. Ultimately the information needs to end up in the company work-request management system ('WRMS') but that system's user interface for timesheeting is somewhat frustrating. In response to …

Map of CPAN - The Movie

poster.pngIf you've visited the Map of CPAN more than once, you'll notice that it has changed quite significantly over time. Coloured namespace areas expand as new distributions are uploaded and this expansion pushes other namespaces around - producing a kind of continental drift.

I thought it might be interesting to assemble a stop-motion animation of these changes. The resul…

Idle alerts with bcvi

In case you haven't met it before, bcvi is a crazy backwards tool (written in Perl of course) that lets you type commands on a server to make things happen on your workstation. I've just released an update to the notifications plugin so I thought I'd blog about it here.

Here's a simple example to illustrate what the notifications plugin does. Imagine you've SSH'd into a server to kick off some long running command and you'd like to be notified when the command finishes. In this example, I'm running a database restore:

$ pg_restore -d acmecrm crm.pgdump; bnotify 'DB is restored!'

When the pg_restore completes, the bnotify command will be run. Bnotify is an alias for bcvi which will send a message back to your workstation to pop up a desktop notification.

The new feature is that bnotify now accepts a --idle option to send you a notification when the TTY is idle. The reason I wanted this is that I'm currently doing a bunch of server upgrades and although the upgrade process mostly runs unattended, I do get prompted for questions at intervals. Here's how I use the new feature:

$ bnotify --idle
Starting background process to monitor /dev/pts/0 for 20 second idle period
Kill monitor with: bnotify --kill
$ sudo apt-get dist-upgrade
[sudo] password for grant: 
Reading package lists... Done
Building dependency tree       
The following NEW packages will be installed:
...

I will then leave the upgrade running and switch to do something in another window (or desktop). Some time later, the upgrade process will either complete or will pause to ask me how I'd like to deal with a possible conflict with a new version of a config file that wants to replace one I've modified. Either way, bnotify will notice that there's been no output on the terminal for some amount of time (default 20 seconds) and will signal my workstation to alert me with a message: "Notification from [servername]. Terminal is idle".

In my case, the workstation end of the notifications process is handled by Desktop::Notify - which works on Linux desktops (e.g. Gnome2/3, XFCE, KDE probably). But you could replace that with something that talked to Growl on a Mac.

Links:

About Grant McLean

user-pic Perl hacker since 1995. Coordinator of Wellington.pm in New Zealand.