| line | stmt | bran | cond | sub | pod | time | code | 
| 1 | 1 |  |  | 1 |  | 49675 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 25 |  | 
| 2 | 1 |  |  | 1 |  | 5 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 46 |  | 
| 3 |  |  |  |  |  |  | package Log::Dispatch::DesktopNotification; # git description: v0.02-12-gd103704 | 
| 4 |  |  |  |  |  |  | # ABSTRACT: Send log messages to a desktop notification system | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | our $VERSION = '0.03'; | 
| 7 |  |  |  |  |  |  |  | 
| 8 | 1 |  |  | 1 |  | 380 | use Module::Load qw/load/; | 
|  | 1 |  |  |  |  | 793 |  | 
|  | 1 |  |  |  |  | 6 |  | 
| 9 | 1 |  |  | 1 |  | 423 | use Module::Load::Conditional qw/can_load/; | 
|  | 1 |  |  |  |  | 19111 |  | 
|  | 1 |  |  |  |  | 56 |  | 
| 10 | 1 |  |  | 1 |  | 409 | use namespace::clean 0.19; | 
|  | 1 |  |  |  |  | 11922 |  | 
|  | 1 |  |  |  |  | 6 |  | 
| 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 |  |  |  |  |  |  | sub new { | 
| 31 | 1 |  |  | 1 | 1 | 174 | my ($class, @args) = @_; | 
| 32 | 1 |  |  |  |  | 5 | 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 |  |  |  |  |  |  | sub output_class { | 
| 47 | 1 | 50 |  | 1 | 1 | 6 | if ($^O eq 'darwin') { | 
| 48 | 0 |  |  |  |  | 0 | my $mod = 'Log::Dispatch::MacGrowl'; | 
| 49 | 0 |  |  |  |  | 0 | load $mod; return $mod; | 
|  | 0 |  |  |  |  | 0 |  | 
| 50 |  |  |  |  |  |  | } | 
| 51 |  |  |  |  |  |  |  | 
| 52 | 1 |  |  |  |  | 3 | my $mod = 'Log::Dispatch::Desktop::Notify'; | 
| 53 | 1 |  |  |  |  | 6 | load $mod; return $mod; | 
|  | 0 |  |  |  |  |  |  | 
| 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; | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | __END__ | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | =pod | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | =encoding UTF-8 | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  | =head1 NAME | 
| 80 |  |  |  |  |  |  |  | 
| 81 |  |  |  |  |  |  | Log::Dispatch::DesktopNotification - Send log messages to a desktop notification system | 
| 82 |  |  |  |  |  |  |  | 
| 83 |  |  |  |  |  |  | =head1 VERSION | 
| 84 |  |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | version 0.03 | 
| 86 |  |  |  |  |  |  |  | 
| 87 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 88 |  |  |  |  |  |  |  | 
| 89 |  |  |  |  |  |  | my $notify = Log::Dispatch::DesktopNotification->new( | 
| 90 |  |  |  |  |  |  | name      => 'notify', | 
| 91 |  |  |  |  |  |  | min_level => 'debug', | 
| 92 |  |  |  |  |  |  | app_name  => 'MyApp', | 
| 93 |  |  |  |  |  |  | ); | 
| 94 |  |  |  |  |  |  |  | 
| 95 |  |  |  |  |  |  | =head1 METHODS | 
| 96 |  |  |  |  |  |  |  | 
| 97 |  |  |  |  |  |  | =head2 new | 
| 98 |  |  |  |  |  |  |  | 
| 99 |  |  |  |  |  |  | Creates a new L<Log::Dispatch> output that can be used to graphically notify a | 
| 100 |  |  |  |  |  |  | user on this system. Uses C<output_class> and calls C<new> on the returned | 
| 101 |  |  |  |  |  |  | class, passing along all arguments. | 
| 102 |  |  |  |  |  |  |  | 
| 103 |  |  |  |  |  |  | =head2 output_class | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  | Returns the name of a L<Log::Dispatch::Output> class that is suitable to | 
| 106 |  |  |  |  |  |  | graphically notify a user on the current system. | 
| 107 |  |  |  |  |  |  |  | 
| 108 |  |  |  |  |  |  | On MacOS X, that will be L<Log::Dispatch::MacGrowl>. On other systems, | 
| 109 |  |  |  |  |  |  | L<Log::Dispatch::Desktop::Notify> will be returned if it is available and usable. | 
| 110 |  |  |  |  |  |  | Otherwise, L<Log::Dispatch::Null> will be returned. | 
| 111 |  |  |  |  |  |  |  | 
| 112 |  |  |  |  |  |  | =head1 LIMITATIONS | 
| 113 |  |  |  |  |  |  |  | 
| 114 |  |  |  |  |  |  | Currently only supports Mac OS X and systems on which notification-daemon is | 
| 115 |  |  |  |  |  |  | available (most *N*Xes). | 
| 116 |  |  |  |  |  |  |  | 
| 117 |  |  |  |  |  |  | =head1 SEE ALSO | 
| 118 |  |  |  |  |  |  |  | 
| 119 |  |  |  |  |  |  | =over 4 | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  | =item * | 
| 122 |  |  |  |  |  |  |  | 
| 123 |  |  |  |  |  |  | L<Log::Dispatch> | 
| 124 |  |  |  |  |  |  |  | 
| 125 |  |  |  |  |  |  | =item * | 
| 126 |  |  |  |  |  |  |  | 
| 127 |  |  |  |  |  |  | L<Log::Dispatch::Desktop::Notify> | 
| 128 |  |  |  |  |  |  |  | 
| 129 |  |  |  |  |  |  | =item * | 
| 130 |  |  |  |  |  |  |  | 
| 131 |  |  |  |  |  |  | L<Log::Dispatch::MacGrowl> | 
| 132 |  |  |  |  |  |  |  | 
| 133 |  |  |  |  |  |  | =item * | 
| 134 |  |  |  |  |  |  |  | 
| 135 |  |  |  |  |  |  | L<Log::Dispatch::Null> | 
| 136 |  |  |  |  |  |  |  | 
| 137 |  |  |  |  |  |  | =back | 
| 138 |  |  |  |  |  |  |  | 
| 139 |  |  |  |  |  |  | =head1 SUPPORT | 
| 140 |  |  |  |  |  |  |  | 
| 141 |  |  |  |  |  |  | Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Log-Dispatch-DesktopNotification> | 
| 142 |  |  |  |  |  |  | (or L<bug-Log-Dispatch-DesktopNotification@rt.cpan.org|mailto:bug-Log-Dispatch-DesktopNotification@rt.cpan.org>). | 
| 143 |  |  |  |  |  |  |  | 
| 144 |  |  |  |  |  |  | =head1 AUTHOR | 
| 145 |  |  |  |  |  |  |  | 
| 146 |  |  |  |  |  |  | Florian Ragwitz <rafl@debian.org> | 
| 147 |  |  |  |  |  |  |  | 
| 148 |  |  |  |  |  |  | =head1 CONTRIBUTORS | 
| 149 |  |  |  |  |  |  |  | 
| 150 |  |  |  |  |  |  | =for stopwords Karen Etheridge Christian Garbs | 
| 151 |  |  |  |  |  |  |  | 
| 152 |  |  |  |  |  |  | =over 4 | 
| 153 |  |  |  |  |  |  |  | 
| 154 |  |  |  |  |  |  | =item * | 
| 155 |  |  |  |  |  |  |  | 
| 156 |  |  |  |  |  |  | Karen Etheridge <ether@cpan.org> | 
| 157 |  |  |  |  |  |  |  | 
| 158 |  |  |  |  |  |  | =item * | 
| 159 |  |  |  |  |  |  |  | 
| 160 |  |  |  |  |  |  | Christian Garbs <mitch@cgarbs.de> | 
| 161 |  |  |  |  |  |  |  | 
| 162 |  |  |  |  |  |  | =back | 
| 163 |  |  |  |  |  |  |  | 
| 164 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENCE | 
| 165 |  |  |  |  |  |  |  | 
| 166 |  |  |  |  |  |  | This software is copyright (c) 2009 by Florian Ragwitz. | 
| 167 |  |  |  |  |  |  |  | 
| 168 |  |  |  |  |  |  | This is free software; you can redistribute it and/or modify it under | 
| 169 |  |  |  |  |  |  | the same terms as the Perl 5 programming language system itself. | 
| 170 |  |  |  |  |  |  |  | 
| 171 |  |  |  |  |  |  | =cut |