File Coverage

blib/lib/App/GitHubWebhooks2Ikachan/Events/CommitComment.pm
Criterion Covered Total %
statement 20 20 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 0 1 0.0
total 25 26 96.1


line stmt bran cond sub pod time code
1             package App::GitHubWebhooks2Ikachan::Events::CommitComment;
2 1     1   5 use strict;
  1         2  
  1         34  
3 1     1   5 use warnings;
  1         2  
  1         26  
4 1     1   6 use utf8;
  1         1  
  1         8  
5 1     1   777 use String::IRC;
  1         1083  
  1         269  
6              
7             sub call {
8 1     1 0 3 my ($class, $context) = @_;
9              
10 1         7 my $comment = $context->dat->{comment};
11              
12 1         13 (my $comment_body = $comment->{body}) =~ s/\r?\n.*//g;
13 1         4 my $user_name = $comment->{user}->{login};
14 1         3 my $url = $comment->{html_url};
15              
16 1         7 my ($commit_id) = $comment->{commit_id} =~ /\A(.{7})/;
17              
18 1         5 my $main_text = "[comment ($commit_id)] $comment_body (\@$user_name)";
19 1         4 return String::IRC->new($main_text)->green . " $url";
20             }
21              
22             1;
23