Permalink
Browse files

add -debug option

  • Loading branch information...
1 parent 514b641 commit 205183bca1b4ea56dd980c088f44d81d42616eda @trinitum committed Dec 3, 2011
Showing with 12 additions and 4 deletions.
  1. +7 −1 bin/metacpan_notify.pl
  2. +5 −3 lib/App/MetaCPAN/Gtk2/Notify.pm
@@ -3,8 +3,14 @@
use strict;
use warnings;
+my %params;
+my $arg = shift;
+if ( $arg && $arg eq '-debug' ) {
+ $params{debug} = 1;
+}
+
use App::MetaCPAN::Gtk2::Notify;
-App::MetaCPAN::Gtk2::Notify->run();
+App::MetaCPAN::Gtk2::Notify->run(%params);
=head1 NAME
@@ -45,7 +45,11 @@ This starts notifier.
=cut
+my %prev_id;
+
sub run {
+ my ( $class, %params ) = @_;
+ $prev_id{1} = 1 if $params{debug};
while (1) {
my @recent = get_recent();
show_recent( \@recent ) if @recent;
@@ -72,8 +76,6 @@ sub get_recent {
}
}
-my %prev_id;
-
=head2 show_recent(\@recent)
Show notifications about recent packages
@@ -84,7 +86,7 @@ sub show_recent {
my $recent = shift;
# skip notifying on first run
- if ( %prev_id ) {
+ if (%prev_id) {
for ( reverse @$recent ) {
next if $prev_id{ $_->{id} };
my ( $auth_name, $avatar ) = @{ get_author( $_->{author} ) };

0 comments on commit 205183b

Please sign in to comment.