Log-Dispatch-Desktop-Notify

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

   },
   "provides" : {
      "Log::Dispatch::Desktop::Notify" : {
         "file" : "lib/Log/Dispatch/Desktop/Notify.pm",
         "version" : "v0.0.2"
      }
   },
   "release_status" : "stable",
   "resources" : {
      "bugtracker" : {
         "web" : "https://github.com/mmitch/fritz/log-dispatch-desktop-notify"
      },
      "repository" : {
         "type" : "git",
         "url" : "git://github.com/mmitch/log-dispatch-desktop-notify.git",
         "web" : "https://github.com/mmitch/log-dispatch-desktop-notify"
      }
   },
   "version" : "v0.0.2",
   "x_serialization_backend" : "JSON::XS version 3.01"
}

META.yml  view on Meta::CPAN

requires:
  Desktop::Notify: '0'
  Log::Dispatch::Null: '0'
  Log::Dispatch::Output: '0'
  Try::Tiny: '0'
  parent: '0'
  perl: '5.006'
  strict: '0'
  warnings: '0'
resources:
  bugtracker: https://github.com/mmitch/fritz/log-dispatch-desktop-notify
  repository: git://github.com/mmitch/log-dispatch-desktop-notify.git
version: v0.0.2
x_serialization_backend: 'YAML::Tiny version 1.69'

README.md  view on Meta::CPAN

Log::Dispatch::Desktop::Notify - Log::Dispatch notification backend using Desktop::Notify
=========================================================================================

[![Build Status](https://travis-ci.org/mmitch/log-dispatch-desktop-notify.svg?branch=master)](https://travis-ci.org/mmitch/log-dispatch-desktop-notify)
[![Coverage Status](https://codecov.io/github/mmitch/log-dispatch-desktop-notify/coverage.svg?branch=master)](https://codecov.io/github/mmitch/log-dispatch-desktop-notify?branch=master)
[![GPL 2+](https://img.shields.io/badge/license-GPL%202%2B-blue.svg)](http://www.gnu.org/licenses/gpl-2.0-standalone.html)


what
----

Log::Dispatch::Desktop::Notify a backend for
[Log::Dispatch](https://metacpan.org/pod/Log::Dispatch) that displays
messages via the Desktop Notification Framework (think `libnotify`)
using [Desktop::Notify](https://metacpan.org/pod/Desktop::Notify).

README.md  view on Meta::CPAN

To install or upgrade Dist::Zilla use

    $ cpan -i Dist::Zilla

or

    $ cpanm Dist::Zilla

Then clone this repository, enter it and start the install process:

    $ git clone https://github.com/mmitch/log-dispatch-desktop-notify.git
    $ cd log-dispatch-desktop-notify
    $ dzil install

Any missing dependencies should be reported automatically and can be
installed by

    $ dzil authordeps --missing | cpanm
    $ dzil listdeps --missing | cpanm

Afterwards, try the installation again with

    $ dzil install


where to get it
---------------

Log::Dispatch::Desktop::Notify source is hosted at
https://github.com/mmitch/log-dispatch-desktop-notify  
The latest released version is available on CPAN at
https://metacpan.org/release/Log-Dispatch-Desktop-Notify


copyright
---------

Copyright (C) 2017  Christian Garbs <mitch@cgarbs.de>  
Licensed under GNU GPL v2 or later.

dist.ini  view on Meta::CPAN

[MetaJSON]
[ManifestSkip]
[MetaProvides::Package]
[PodSyntaxTests]
[PodCoverageTests]
[Test::Perl::Critic]
[AutoPrereqs]
[PkgVersion]
[PodWeaver]
[Bugtracker]
web = https://github.com/mmitch/fritz/log-dispatch-desktop-notify

lib/Log/Dispatch/Desktop/Notify.pm  view on Meta::CPAN

use Desktop::Notify;
use Log::Dispatch::Null;
use Try::Tiny;

use parent 'Log::Dispatch::Output';


sub new {
    my ($class, %params) = @_;

    if (_desktop_notify_unavailable()) {
	return Log::Dispatch::Null->new(%params);
    };

    my $self = bless {
	_timeout  => -1,
	_app_name => $0,
    }, $class;

    $self->_basic_init(%params);
    $self->_init(%params);

lib/Log/Dispatch/Desktop/Notify.pm  view on Meta::CPAN


sub _init {
    my ($self, %params) = @_;

    $self->{_app_name} = $params{app_name} if defined $params{app_name};
    $self->{_timeout}  = $params{timeout}  if defined $params{timeout};

    $self->{_notify} = Desktop::Notify->new( app_name => $self->{_app_name} );
};

sub _desktop_notify_unavailable() {
    return try {
	Desktop::Notify->new();
	0;
    } catch {
	1;
    }
}


sub log_message {

lib/Log/Dispatch/Desktop/Notify.pm  view on Meta::CPAN

=head2 log_message

This message is called internally by C<Log::Dispatch::log()> to
display a message.  Expects named parameters in a hash.  Currently,
only the usual L<Log::Dispatch::Output> parameters C<level> and
C<message> are supported.

=head1 BUGS AND LIMITATIONS

To report a bug, please use the github issue tracker:
L<https://github.com/mmitch/log-dispatch-desktop-notify/issues>

=head1 AVAILABILITY

=over

=item github repository

L<git://github.com/mmitch/log-dispatch-desktop-notify.git>

=item github browser

L<https://github.com/mmitch/log-dispatch-desktop-notify>

=item github issue tracker

L<https://github.com/mmitch/log-dispatch-desktop-notify/issues>

=back

=begin html

=head1 BUILD STATUS

<p><a href="https://travis-ci.org/mmitch/log-dispatch-desktop-notify"><img src="https://travis-ci.org/mmitch/log-dispatch-desktop-notify.svg?branch=master" alt="Build Status"></a></p>


=end html

=begin html

=head1 TEST COVERAGE

<p><a href="https://codecov.io/github/mmitch/log-dispatch-desktop-notify?branch=master"><img src="https://codecov.io/github/mmitch/log-dispatch-desktop-notify/coverage.svg?branch=master" alt="Coverage Status"></a></p>


=end html

=head1 SEE ALSO

=over

=item *



( run in 0.294 second using v1.01-cache-2.11-cpan-299005ec8e3 )