RDBO.pm untested

filter: Statementstmt 0.0% 0 / 37 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 12 Podpod 0.0% 0 / 8 totaltotal 0.0% 0 / 62 CC 2 SCAR 9.6
CC
2
Cov
0%
new
6.0
BEGIN
2.0
from_session
2.0
CRAP 2.6
1 package Catalyst::Authentication::Store::RDBO;
2 use strict;
3 use warnings;
4 use 5.008_001;
5 use base qw/Class::Accessor::Fast/;
6  
7 our $VERSION = "0.1000";
8  
9 BEGIN {
10 __PACKAGE__->mk_accessors(qw/config/);
11 }
12  
13 sub new
14 {
15 my ($class, $config, $app) = @_;
16  
17 ## figure out if we are overriding the default store user class
18 $config->{'store_user_class'} = exists($config->{'store_user_class'})
19 ? $config->{'store_user_class'}
20 : "Catalyst::Authentication::Store::RDBO::User";
21  
22 ## make sure the store class is loaded.
23 Catalyst::Utils::ensure_class_loaded($config->{'store_user_class'});
24  
25 ## fields can be specified to be ignored during user location. This allows
26 ## the store to ignore certain fields in the authinfo hash.
27  
28 $config->{'ignore_fields_in_find'} ||= [];
29  
30 my $self = { config => $config };
31  
32 bless $self, $class;
33  
34 }
35  
36 sub from_session
37 {
38 my ($self, $c, $frozenuser) = @_;
39  
40 my $user = $self->config->{'store_user_class'}->new($self->{'config'}, $c);
41 return $user->from_session($frozenuser, $c);
42 }
43  
44 sub for_session
45 {
46 my ($self, $c, $user) = @_;
47  
48 return $user->for_session($c);
49 }
50  
51 sub find_user
52 {
53 my ($self, $authinfo, $c) = @_;
54  
55 my $user = $self->config->{'store_user_class'}->new($self->{'config'}, $c);
56  
57 return $user->load($authinfo, $c);
58 }
59  
60 sub user_supports
61 {
62 my $self = shift;
63  
64 # this can work as a class method on the user class
65 $self->config->{'store_user_class'}->supports(@_);
66 }
67  
68 sub auto_create_user
69 {
70 my ($self, $authinfo, $c) = @_;
71 my $res = $self->config->{'store_user_class'}->new($self->{'config'}, $c);
72 return $res->auto_create($authinfo, $c);
73 }
74  
75 sub auto_update_user
76 {
77 my ($self, $authinfo, $c, $res) = @_;
78 $res->auto_update($authinfo, $c);
79 return $res;
80 }
81  
82 1; # End of Catalyst::Authentication::Store::RDBO
83  
84 __END__