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   31449 use strict;
  2         3  
  2         106  
3 2     2   8 use warnings;
  2         4  
  2         55  
4              
5 2     2   268 use Github::Hooks::Receiver;
  2         4  
  2         50  
6 2     2   16 use parent 'Exporter';
  2         1  
  2         13  
7              
8             our @EXPORT = qw/receiver secret on/;
9              
10             our $_RECEIVER;
11             sub receiver(&) {
12 2     2 0 12757 my $code = shift;
13 2         23 local $_RECEIVER = Github::Hooks::Receiver->new;
14 2         19 $code->();
15 2         4 $_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 898 die 'not in receiver block' unless $_RECEIVER;
25 4         16 $_RECEIVER->on(@_);
26             }
27              
28             1;
29             __END__