File Coverage

blib/lib/App/Slackeria/Plugin/Freshmeat.pm
Criterion Covered Total %
statement 13 15 86.6
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 18 20 90.0


line stmt bran cond sub pod time code
1             package App::Slackeria::Plugin::Freshmeat;
2              
3 1     1   3983067 use strict;
  1         30  
  1         158  
4 1     1   10 use warnings;
  1         3  
  1         883  
5 1     1   703 use 5.010;
  1         16  
  1         88  
6              
7 1     1   1544 use parent 'App::Slackeria::Plugin';
  1         2983  
  1         11  
8              
9 1     1   1485 use WWW::Freshmeat;
  0            
  0            
10              
11             our $VERSION = '0.12';
12              
13             sub new {
14             my ( $obj, %conf ) = @_;
15             my $ref = {};
16             $ref->{default} = \%conf;
17             $ref->{default}->{href} //= 'http://freshmeat.net/projects/%s/';
18             $ref->{fm} = WWW::Freshmeat->new( token => $conf{token} );
19             return bless( $ref, $obj );
20             }
21              
22             sub check {
23             my ( $self, $res ) = @_;
24              
25             my $fp = $self->{fm}->retrieve_project( $self->{conf}->{name} );
26              
27             if ( defined $fp ) {
28             return {
29             data => $fp->version(),
30             description => $fp->description(),
31             };
32             }
33             else {
34             die("not found\n");
35             }
36             }
37              
38             1;
39              
40             __END__