line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CPAN::Mini::Growl; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
4
|
1
|
|
|
1
|
|
27
|
use 5.008_001; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
118
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
6
|
use base qw( CPAN::Mini ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
2368
|
|
8
|
1
|
|
|
1
|
|
216495
|
use Digest::MD5; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
64
|
|
9
|
1
|
|
|
1
|
|
8
|
use File::Spec; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
10
|
1
|
|
|
1
|
|
601
|
use Mac::Growl; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use LWP::Simple; |
12
|
|
|
|
|
|
|
use CPAN::DistnameInfo; |
13
|
|
|
|
|
|
|
use Parse::CPAN::Authors; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $AppName = "CPAN::Mini::Growl"; |
16
|
|
|
|
|
|
|
my $EventType = "New Distribution"; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub update_mirror { |
19
|
|
|
|
|
|
|
my $class = shift; |
20
|
|
|
|
|
|
|
my $self = $class->SUPER::new(@_); |
21
|
|
|
|
|
|
|
$self->SUPER::update_mirror; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Mac::Growl::RegisterNotifications($AppName, [ $EventType ], [ $EventType ]); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $file = File::Spec->catfile($self->{local}, "authors", "01mailrc.txt.gz"); |
26
|
|
|
|
|
|
|
my $pause = Parse::CPAN::Authors->new($file); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $cache = File::Spec->catfile($self->{local}, "avatars"); |
29
|
|
|
|
|
|
|
mkdir $cache, 0777 unless -e $cache; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my @modules = grep !/CHECKSUMS/, keys %{$self->{recent}}; |
32
|
|
|
|
|
|
|
for my $module (@modules) { |
33
|
|
|
|
|
|
|
if ($module =~ m!^authors/id/!) { |
34
|
|
|
|
|
|
|
my $dist = CPAN::DistnameInfo->new($module) or next; |
35
|
|
|
|
|
|
|
my $author = $pause->author($dist->cpanid) or next; |
36
|
|
|
|
|
|
|
my $icon = File::Spec->catfile($cache, $dist->cpanid . ".jpg"); |
37
|
|
|
|
|
|
|
unless (-e $icon) { |
38
|
|
|
|
|
|
|
my $md5 = Digest::MD5::md5_hex($author->email); |
39
|
|
|
|
|
|
|
my $gravatar = "http://www.gravatar.com/avatar.php?gravatar_id=$md5&rating=G&size=80&default=http%3A%2F%2Fst.pimg.net%2Ftucs%2Fimg%2Fwho.png"; |
40
|
|
|
|
|
|
|
LWP::Simple::mirror($gravatar, $icon); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my $msg = $author->name . " released " . $dist->distvname; |
44
|
|
|
|
|
|
|
Mac::Growl::PostNotification($AppName, $EventType, $dist->distvname, $msg, 0, 0, $icon); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
__END__ |