File Coverage

blib/lib/Dancer/Plugin/reCAPTCHA.pm
Criterion Covered Total %
statement 9 14 64.2
branch n/a
condition n/a
subroutine 3 5 60.0
pod n/a
total 12 19 63.1


line stmt bran cond sub pod time code
1             package Dancer::Plugin::reCAPTCHA;
2             # ABSTRACT: Easily integrate reCAPTCHA into your Dancer applications
3             {
4             $Dancer::Plugin::reCAPTCHA::VERSION = '0.4';
5             }
6              
7              
8 1     1   1043874 use Dancer ':syntax';
  1         1177166  
  1         7  
9 1     1   1328 use Dancer::Plugin;
  1         2938  
  1         96  
10 1     1   13 use Captcha::reCAPTCHA;
  1         6  
  1         170  
11              
12             my $rc = Captcha::reCAPTCHA->new;
13              
14              
15             register recaptcha_display => sub {
16 0     0     my $conf = plugin_setting();
17             return $rc->get_html(
18             $conf->{ public_key },
19             undef,
20             $conf->{ use_ssl },
21             { theme => $conf->{ theme }},
22 0           );
23             };
24              
25              
26             register recaptcha_check => sub {
27 0     0     my ( $challenge, $response ) = @_;
28 0           my $conf = plugin_setting();
29             return $rc->check_answer(
30             $conf->{ private_key },
31 0           request->remote_address,
32             $challenge,
33             $response,
34             );
35             };
36              
37              
38             register_plugin;
39             1;
40              
41             __END__