File Coverage

blib/lib/Dancer2/Plugin/AppRole/Helper.pm
Criterion Covered Total %
statement 11 11 100.0
branch 2 2 100.0
condition n/a
subroutine 4 4 100.0
pod 2 2 100.0
total 19 19 100.0


line stmt bran cond sub pod time code
1             package Dancer2::Plugin::AppRole::Helper;
2              
3 1     1   19501 use strictures 2;
  1         7  
  1         38  
4              
5             our $VERSION = '1.152121'; # VERSION
6              
7             # ABSTRACT: helper functions for creating Dancer2 AppRole plugins
8              
9             #
10             # This file is part of Dancer2-Plugin-AppRole-Helper
11             #
12             #
13             # Christian Walde has dedicated the work to the Commons by waiving all of his
14             # or her rights to the work worldwide under copyright law and all related or
15             # neighboring legal rights he or she had in the work, to the extent allowable by
16             # law.
17             #
18             # Works under CC0 do not require attribution. When citing the work, you should
19             # not imply endorsement by the author.
20             #
21              
22              
23 1     1   654 use parent 'Exporter';
  1         294  
  1         4  
24              
25             our @EXPORT = qw(ensure_approle ensure_approle_s);
26              
27              
28             sub ensure_approle {
29 3     3 1 12203 my ( $role, $dsl ) = @_;
30 3         10 my $app = $dsl->app;
31 3 100       14 return if $app->does( $role );
32 2         45 Moo::Role->apply_roles_to_object( $app, $role );
33             }
34              
35              
36 1     1 1 206 sub ensure_approle_s { ensure_approle "Dancer2::Plugin::AppRole::" . shift, @_ }
37              
38             1;
39              
40             __END__