Growl from command line

I am a Mac OS X user, and I like Growl. To see notifications can be irritating, sometimes. Irritating and distracting. But this doesn’t mean the tool is not useful.

And I find it useful when processing large quantities of data, and when this process is split in different small processes. In these cases, I like to have Growl warning me about what stage of the process is starting/ending and, when it finishes, to have a final warn about it.

While I can use Growl directly from Perl, that doesn’t work easily when using makefiles, for instance. Then, I wrote a small script that I put into my user binaries folder, and that reads the message from the command line, just like:

 growl Hello World!

In case someone finds this code useful, here it is:

use Mac::Growl ':all';
RegisterNotifications("Command Line", ["Note"], ["Note"]);
PostNotification("Command Line", "Note", "Note", join(" ", @ARGV));

Leave a comment

About Alberto Simões

user-pic I blog about Perl. D'uh!