1package Plagger::Plugin::Notify::Growl; 2use strict; 3use base qw( Plagger::Plugin ); 4 5use Encode; 6use Mac::Growl ':all'; 7 8sub register { 9 my($self, $context) = @_; 10 11 $context->register_hook( 12 $self, 13 'publish.init' => \&initialize, 14 'publish.entry' => \&entry, 15 ); 16} 17 18sub initialize { 19 my ($self, $context) = @_; 20 my @updates; 21 for my $update ($context->update->feeds){ 22 push @updates, encode_utf8($update->title_text); 23 } 24 Mac::Growl::RegisterNotifications("plagger", [@updates],[@updates]); 25} 26 27sub entry { 28 my($self, $context, $args) = @_; 29 Mac::Growl::PostNotification( 30 "plagger", 31 encode_utf8($args->{feed}->title_text), 32 encode_utf8($args->{entry}->title_text), 33 encode_utf8($args->{entry}->body_text) 34 ); 35} 36 371; 38 39 40