| 1 | package Jaipo::Notify::MacGrowl; | ||
| 2 | |||
| 3 | use warnings; | ||
| 4 | use strict; | ||
| 5 | use base 'Mac::Growl'; | ||
| 6 | |||
| 7 | =encoding utf8 | ||
| 8 | |||
| 9 | =head1 NAME | ||
| 10 | |||
| 11 | Jaipo::Notify::MacGrowl - A easy-to-use interface to show desktop notifications with Growl on Mac OSX. | ||
| 12 | |||
| 13 | |||
| 14 | =head1 SYNOPSIS | ||
| 15 | |||
| 16 | Jaipo::Notify::MacGrowl is a easy-to-use interface to show desktop notifications with Grwol on Mac OSX. | ||
| 17 | |||
| 18 | |||
| 19 | use Jaipo::Notify::MacGrowl; | ||
| 20 | |||
| 21 | my $notify = Jaipo::Notify::MacGrowl->new(); | ||
| 22 | |||
| 23 | # yell for Service Notify. | ||
| 24 | $notify->yell('Cannot connect to M$-Mi$roBlo$: $!'); | ||
| 25 | # display for message displaying. | ||
| 26 | $notify->display("From Mr.Right: Hello Darling. How are you today?"); | ||
| 27 | |||
| 28 | # get current timeout setting | ||
| 29 | print Data::Dumper $notify->timeout; | ||
| 30 | # set yell timeout to 10 seconds. default is 5. | ||
| 31 | $notify->timeout("yell" => 10); | ||
| 32 | # set display timeout to 5 seconds. default is 3. | ||
| 33 | $notify->timeout("yell" => 5); | ||
| 34 | |||
| 35 | =head1 FUNCTIONS | ||
| 36 | |||
| 37 | =head2 new | ||
| 38 | |||
| 39 | Return a object which talks to Growl. | ||
| 40 | |||
| 41 | =cut | ||
| 42 | |||
| 43 | sub new { | ||
| 44 | my $class = shift; | ||
| 45 | my %args = @_; | ||
| 46 | print "Mac::Growl Notifier Initialized\n"; | ||
| 47 | my $self = {}; | ||
| 48 | bless $self, $class; | ||
| 49 | Mac::Growl::RegisterNotifications( 'Jaipo', [ 'Updates' ], [ 'Updates' ], "" ); | ||
| 50 | return $self; | ||
| 51 | } | ||
| 52 | |||
| 53 | =head2 yell | ||
| 54 | |||
| 55 | yell for Service Notify. | ||
| 56 | Pops a notification with title "Jaipo Service Notify" and the given message content from you. | ||
| 57 | |||
| 58 | =cut | ||
| 59 | |||
| 60 | sub yell { | ||
| 61 | my ($self, $msg) = @_; | ||
| 62 | Mac::Growl::PostNotification( 'Jaipo', 'Updates' , 'Jaipo', $msg ); | ||
| 63 | } | ||
| 64 | |||
| 65 | =head2 display | ||
| 66 | |||
| 67 | display for message displaying. | ||
| 68 | Pops a notification with title "You've Got Message!" and the given message content from you. | ||
| 69 | |||
| 70 | =cut | ||
| 71 | |||
| 72 | sub display { | ||
| 73 | my ($self, $msg) = @_; | ||
| 74 | Mac::Growl::PostNotification( 'Jaipo', 'Updates' , 'Jaipo', $msg ); | ||
| 75 | } | ||
| 76 | |||
| 77 | =head2 timeout | ||
| 78 | |||
| 79 | timeout for changing/getting the current timeout value. | ||
| 80 | Not implemented. | ||
| 81 | |||
| 82 | =cut | ||
| 83 | |||
| 84 | sub timeout { | ||
| 85 | my $self = shift; | ||
| 86 | } | ||
| 87 | |||
| 88 | =head1 AUTHOR | ||
| 89 | |||
| 90 | BlueT - Matthew Lien - 練喆明, C<< <BlueT at BlueT.org> >> | ||
| 91 | |||
| 92 | =head1 BUGS | ||
| 93 | |||
| 94 | Please report any bugs or feature requests to C<bug-jaipo-notify-macgrowl at rt.cpan.org>, or through | ||
| 95 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Jaipo-Notify-MacGrowl>. I will be notified, and then you'll | ||
| 96 | automatically be notified of progress on your bug as I make changes. | ||
| 97 | |||
| 98 | |||
| 99 | |||
| 100 | |||
| 101 | =head1 SUPPORT | ||
| 102 | |||
| 103 | You can find documentation for this module with the perldoc command. | ||
| 104 | |||
| 105 | perldoc Jaipo::Notify::MacGrowl | ||
| 106 | |||
| 107 | |||
| 108 | You can also look for information at: | ||
| 109 | |||
| 110 | =over 4 | ||
| 111 | |||
| 112 | =item * RT: CPAN's request tracker | ||
| 113 | |||
| 114 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Jaipo-Notify-MacGrowl> | ||
| 115 | |||
| 116 | =item * AnnoCPAN: Annotated CPAN documentation | ||
| 117 | |||
| 118 | L<http://annocpan.org/dist/Jaipo-Notify-MacGrowl> | ||
| 119 | |||
| 120 | =item * CPAN Ratings | ||
| 121 | |||
| 122 | L<http://cpanratings.perl.org/d/Jaipo-Notify-MacGrowl> | ||
| 123 | |||
| 124 | =item * Search CPAN | ||
| 125 | |||
| 126 | L<http://search.cpan.org/dist/Jaipo-Notify-MacGrowl> | ||
| 127 | |||
| 128 | =back | ||
| 129 | |||
| 130 | |||
| 131 | =head1 ACKNOWLEDGEMENTS | ||
| 132 | |||
| 133 | |||
| 134 | =head1 COPYRIGHT & LICENSE | ||
| 135 | |||
| 136 | Copyright 2009 BlueT - Matthew Lien - 練喆明, all rights reserved. | ||
| 137 | |||
| 138 | This program is free software; you can redistribute it and/or modify it | ||
| 139 | under the same terms as Perl itself. | ||
| 140 | |||
| 141 | |||
| 142 | =cut | ||
| 143 | |||
| 144 | 1; # End of Jaipo::Notify::MacGrowl |