App-MetaCPAN-Gtk2-Notify
view release on metacpan or search on metacpan
--- #YAML:1.0
name: App-MetaCPAN-Gtk2-Notify
version: 0.05
abstract: Notify about recent modules uploaded to CPAN
author:
- Pavel Shaydo <zwon@cpan.org>
license: perl
distribution_type: module
configure_requires:
ExtUtils::MakeMaker: 0
build_requires:
ExtUtils::MakeMaker: 0
requires:
File::Slurp: 0
App-MetaCPAN-Gtk2-Notify
Script displays notifications about recent uploads to cpan
INSTALLATION
To install this module, run the following commands:
perl Makefile.PL
make
make test
make install
bin/metacpan_notify.pl view on Meta::CPAN
use App::MetaCPAN::Gtk2::Notify;
App::MetaCPAN::Gtk2::Notify->run(%params);
=head1 NAME
metacpan_notify.pl
=head1 DESCRIPTION
Script displays notifications about modules recently uploaded on CPAN
=head1 ACKNOWLEGEMENTS
I borrowed idea from metacpan-growler.pl script by Hideaki Ohno.
See https://github.com/hideo55/metacpan-growler.
=head1 AUTHOR
Pavel Shaydo, C<< <zwon at cpan.org> >>
lib/App/MetaCPAN/Gtk2/Notify.pm view on Meta::CPAN
use JSON;
use LWP::UserAgent;
use Gtk2::Notify;
use File::Temp ();
use File::Spec;
use File::Slurp qw(write_file);
=head1 NAME
App::MetaCPAN::Gtk2::Notify - Notify about recent modules uploaded to CPAN
=head1 SYNOPSIS
use App::MetaCPAN::Gtk2::Notify;
App::MetaCPAN::Gtk2::Notify->run;
=head1 METHODS
=cut
lib/App/MetaCPAN/Gtk2/Notify.pm view on Meta::CPAN
sub show_recent {
my $recent = shift;
# skip notifying on a first run
if (%prev_id) {
Gtk2::Notify->init('MetaCPAN_recent');
for ( reverse @$recent ) {
next if $prev_id{ $_->{id} };
my ( $auth_name, $avatar ) = @{ get_author( $_->{author} ) };
my $url = "https://metacpan.org/release/$_->{author}/$_->{name}";
Gtk2::Notify->new( "$auth_name ($_->{author})", "uploaded <a href='$url'>$_->{name}</a>", $avatar || () )
->show;
}
Gtk2::Notify->uninit;
}
%prev_id = map { $_ => 1 } map { $_->{id} } @$recent;
}
my %authors;
my $tmpdir = File::Temp->newdir;
( run in 1.093 second using v1.01-cache-2.11-cpan-b16cb0d3907 )