| 1 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | package Log::Dispatch::DesktopNotification; # git description: v0.02-12-gd103704 | ||||||||||
| 4 | # ABSTRACT: Send log messages to a desktop notification system | ||||||||||
| 5 | |||||||||||
| 6 | 1 | our $VERSION = '0.03'; | |||||||||
| 7 | |||||||||||
| 8 | 1 | ▶ | use Module::Load qw/load/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use Module::Load::Conditional qw/can_load/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 1 | ▶ | use namespace::clean 0.19; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | #pod =head1 SYNOPSIS | ||||||||||
| 13 | #pod | ||||||||||
| 14 | #pod my $notify = Log::Dispatch::DesktopNotification->new( | ||||||||||
| 15 | #pod name => 'notify', | ||||||||||
| 16 | #pod min_level => 'debug', | ||||||||||
| 17 | #pod app_name => 'MyApp', | ||||||||||
| 18 | #pod ); | ||||||||||
| 19 | #pod | ||||||||||
| 20 | #pod =head1 METHODS | ||||||||||
| 21 | #pod | ||||||||||
| 22 | #pod =head2 new | ||||||||||
| 23 | #pod | ||||||||||
| 24 | #pod Creates a new L<Log::Dispatch> output that can be used to graphically notify a | ||||||||||
| 25 | #pod user on this system. Uses C<output_class> and calls C<new> on the returned | ||||||||||
| 26 | #pod class, passing along all arguments. | ||||||||||
| 27 | #pod | ||||||||||
| 28 | #pod =cut | ||||||||||
| 29 | |||||||||||
| 30 | 1 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 31 | 1 | my ($class, @args) = @_; | |||||||||
| 32 | 1 | return $class->output_class->new(@args); | |||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | #pod =head2 output_class | ||||||||||
| 36 | #pod | ||||||||||
| 37 | #pod Returns the name of a L<Log::Dispatch::Output> class that is suitable to | ||||||||||
| 38 | #pod graphically notify a user on the current system. | ||||||||||
| 39 | #pod | ||||||||||
| 40 | #pod On MacOS X, that will be L<Log::Dispatch::MacGrowl>. On other systems, | ||||||||||
| 41 | #pod L<Log::Dispatch::Desktop::Notify> will be returned if it is available and usable. | ||||||||||
| 42 | #pod Otherwise, L<Log::Dispatch::Null> will be returned. | ||||||||||
| 43 | #pod | ||||||||||
| 44 | #pod =cut | ||||||||||
| 45 | |||||||||||
| 46 | 1 | ▶ | sub output_class { | ||||||||
|
Subroutine
output_class: called CC=2 SCAR=9.9
Pod
documented
| |||||||||||
| 47 | 1 | ▶ | if ($^O eq 'darwin') { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 48 | 0 | my $mod = 'Log::Dispatch::MacGrowl'; | |||||||||
| 49 | 0 | load $mod; return $mod; | |||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | 1 | my $mod = 'Log::Dispatch::Desktop::Notify'; | |||||||||
| 53 | 0 | load $mod; return $mod; | |||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | #pod =head1 LIMITATIONS | ||||||||||
| 57 | #pod | ||||||||||
| 58 | #pod Currently only supports Mac OS X and systems on which notification-daemon is | ||||||||||
| 59 | #pod available (most *N*Xes). | ||||||||||
| 60 | #pod | ||||||||||
| 61 | #pod =head1 SEE ALSO | ||||||||||
| 62 | #pod | ||||||||||
| 63 | #pod =for :list | ||||||||||
| 64 | #pod * L<Log::Dispatch> | ||||||||||
| 65 | #pod * L<Log::Dispatch::Desktop::Notify> | ||||||||||
| 66 | #pod * L<Log::Dispatch::MacGrowl> | ||||||||||
| 67 | #pod * L<Log::Dispatch::Null> | ||||||||||
| 68 | #pod | ||||||||||
| 69 | #pod =cut | ||||||||||
| 70 | |||||||||||
| 71 | 1 | 1; | |||||||||
| 72 | |||||||||||
| 73 | __END__ | ||||||||||