Jaipo
view release on metacpan or search on metacpan
lib/Jaipo/Notify/MacGrowl.pm view on Meta::CPAN
package Jaipo::Notify::MacGrowl;
use warnings;
use strict;
use base 'Mac::Growl';
=encoding utf8
=head1 NAME
Jaipo::Notify::MacGrowl - A easy-to-use interface to show desktop notifications with Growl on Mac OSX.
=head1 SYNOPSIS
Jaipo::Notify::MacGrowl is a easy-to-use interface to show desktop notifications with Grwol on Mac OSX.
use Jaipo::Notify::MacGrowl;
my $notify = Jaipo::Notify::MacGrowl->new();
# yell for Service Notify.
$notify->yell('Cannot connect to M$-Mi$roBlo$: $!');
# display for message displaying.
$notify->display("From Mr.Right: Hello Darling. How are you today?");
# get current timeout setting
print Data::Dumper $notify->timeout;
# set yell timeout to 10 seconds. default is 5.
$notify->timeout("yell" => 10);
# set display timeout to 5 seconds. default is 3.
$notify->timeout("yell" => 5);
=head1 FUNCTIONS
=head2 new
Return a object which talks to Growl.
=cut
sub new {
my $class = shift;
my %args = @_;
print "Mac::Growl Notifier Initialized\n";
my $self = {};
bless $self, $class;
Mac::Growl::RegisterNotifications( 'Jaipo', [ 'Updates' ], [ 'Updates' ], "" );
return $self;
}
=head2 yell
yell for Service Notify.
Pops a notification with title "Jaipo Service Notify" and the given message content from you.
=cut
sub yell {
my ($self, $msg) = @_;
Mac::Growl::PostNotification( 'Jaipo', 'Updates' , 'Jaipo', $msg );
}
=head2 display
display for message displaying.
Pops a notification with title "You've Got Message!" and the given message content from you.
=cut
sub display {
my ($self, $msg) = @_;
Mac::Growl::PostNotification( 'Jaipo', 'Updates' , 'Jaipo', $msg );
}
( run in 0.486 second using v1.01-cache-2.11-cpan-5735350b133 )