File Coverage

blib/lib/Github/Hooks/Receiver/Declare.pm
Criterion Covered Total %
statement 20 20 100.0
branch 3 4 75.0
condition n/a
subroutine 7 7 100.0
pod 0 3 0.0
total 30 34 88.2


line stmt bran cond sub pod time code
1             package Github::Hooks::Receiver::Declare;
2 2     2   42693 use strict;
  2         3  
  2         67  
3 2     2   11 use warnings;
  2         3  
  2         52  
4              
5 2     2   343 use Github::Hooks::Receiver;
  2         5  
  2         85  
6 2     2   12 use parent 'Exporter';
  2         3  
  2         14  
7              
8             our @EXPORT = qw/receiver secret on/;
9              
10             our $_RECEIVER;
11             sub receiver(&) {
12 2     2 0 3186 my $code = shift;
13 2         23 local $_RECEIVER = Github::Hooks::Receiver->new;
14 2         21 $code->();
15 2         5 $_RECEIVER;
16             }
17              
18             sub secret($) {
19 1 50   1 0 9 die 'not in receiver block' unless $_RECEIVER;
20 1         4 $_RECEIVER->{secret} = $_[0];
21             }
22              
23             sub on($;$) {
24 5 100   5 0 1044 die 'not in receiver block' unless $_RECEIVER;
25 4         18 $_RECEIVER->on(@_);
26             }
27              
28             1;
29             __END__