Thursday, November 6, 2008

perl work with growl

Excerpt from
http://oreilly.com/catalog/9780596526740/toc.html
and
http://search.cpan.org/~cnandor/Mac-Growl-0.67/lib/Mac/Growl.pm

A quick method to post notification to Growl.


#!/usr/bin/env perl

use warnings;
use strict;

use Mac::Growl qw(:all);

Mac::Growl::RegisterNotifications(
# register your application in Growl before posting.
# just one time enough.
'growlalert', # app name
['alert'], # all notification
['alert'], # default notification
);

Mac::Growl::PostNotification(
# post notification to Growl
"growlalert", # app name
"alert", # notification type
"this is a title", # alert title
"this is a description", # alert content
);