File Coverage

blib/lib/Dancer/Plugin/Auth/RBAC/Credentials.pm
Criterion Covered Total %
statement 24 24 100.0
branch 2 2 100.0
condition n/a
subroutine 7 7 100.0
pod 0 3 0.0
total 33 36 91.6


line stmt bran cond sub pod time code
1             # ABSTRACT: Dancer::Plugin::Auth::RBAC Credentials base class and guide!
2              
3             package Dancer::Plugin::Auth::RBAC::Credentials;
4             BEGIN {
5 2     2   39 $Dancer::Plugin::Auth::RBAC::Credentials::VERSION = '1.110720';
6             }
7              
8 2     2   11 use strict;
  2         3  
  2         50  
9 2     2   11 use warnings;
  2         4  
  2         46  
10              
11 2     2   9 use Dancer qw/:syntax/;
  2         3  
  2         13  
12              
13              
14             sub new {
15 6     6 0 14 my $class = shift;
16 6         16 my $self = {};
17 6         23 bless $self, $class;
18 6         54 return $self;
19             }
20              
21             sub credentials {
22 6     6 0 15 my $self = shift;
23 6 100       20 if (@_) {
24 4         17 return session 'user' => @_;
25             }
26             else {
27 2         11 return session('user');
28             }
29             }
30              
31             sub errors {
32 2     2 0 6 my ($self, @errors) = @_;
33 2         9 my $user = session('user');
34 2         6033 push @{$user->{error}}, @errors;
  2         9  
35             #return session 'user' => $user;
36 2         9 session 'user' => $user;
37 2         12566 return @errors;
38             }
39              
40             1;
41             __END__