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   48530 use strict;
  2         4  
  2         88  
3 2     2   9 use warnings;
  2         3  
  2         52  
4              
5 2     2   288 use Github::Hooks::Receiver;
  2         4  
  2         46  
6 2     2   14 use parent 'Exporter';
  2         2  
  2         14  
7              
8             our @EXPORT = qw/receiver secret on/;
9              
10             our $_RECEIVER;
11             sub receiver(&) {
12 2     2 0 10690 my $code = shift;
13 2         22 local $_RECEIVER = Github::Hooks::Receiver->new;
14 2         20 $code->();
15 2         5 $_RECEIVER;
16             }
17              
18             sub secret($) {
19 1 50   1 0 8 die 'not in receiver block' unless $_RECEIVER;
20 1         4 $_RECEIVER->{secret} = $_[0];
21             }
22              
23             sub on($;$) {
24 5 100   5 0 768 die 'not in receiver block' unless $_RECEIVER;
25 4         17 $_RECEIVER->on(@_);
26             }
27              
28             1;
29             __END__