Standalone/Config.pm untested

filter: Statementstmt 0.0% 0 / 24 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 41 CC 4 SCAR 24.0
CC
4
Cov
0%
get
20.0
BEGIN
2.0
BEGIN
2.0
CRAP 11.0
1 package Net::OpenID::Server::Standalone::Config;
2  
3 use strict;
4 use warnings;
5  
6 our $config;
7  
8 =pod
9  
10 =head1 NAME
11  
12 Net::OpenID::Server::Standalone::Config - configuration package for Nossa
13  
14 =head1 SYNOPSIS
15  
16 used internally by Net::OpenID::Server::Standalone. The only sub is:
17  
18 =head2 get( @args )
19  
20 follows your $config as a hash of hashes consequentially.
21  
22 =head2 $config
23  
24 used to store all your configuration like this:
25
26 our $config = {
27 #users stuff
28 users => {
29 # nickname is a key
30 'the_your_nickname' => {
31 # hashFunction from password, MD5 by default
32 pass => 'md5_base64 of your password',
33 # OpenID URL
34 url => 'http://your.openid.url/',
35 # function to recognise sites that you trust to be asking about your OpenID, you'd be asked about it otherwise.
36 trust_root => sub{
37 shift =~ m/(blogger\.com|cpan\.org|ccmixter\.org|stickr\.com|mychores\.co\.uk\/openid|qdos\.com
38 |demand-openid\.rpxnow\.com|livejournal\.com|sourceforge\.net)\/?$/x;
39 },
40 # http://openid.net/specs/openid-simple-registration-extension-1_0.html
41 sre => {
42 'sreg.nickname' => 'nickname_for_outside_world',
43 'sreg.fullname' => 'Your Fullname',
44 },
45 },
46 },
47 # Where to redirect in case of wrong login/pass or the wrong OpenID url
48 setupUrl => '/setup',
49 # your id script URL
50 idSvrUrl => '/id',
51 # your OpenID server key
52 serverSecret => 'some_random_sequence_put_your_own',
53 # whether to redirect a user to the SSL URL of id
54 requireSsl=> 0,
55 # arguments for L<CGI::Session>
56 session => {
57 dsn =>"driver:DB_File;serializer:FreezeThaw",
58 name => 'nossa_cookie',
59 expire => '+1h',
60 },
61 };
62  
63 =head1 ETCETERA
64  
65 is at L<Net::Server::OpenID::Standalone>.
66  
67 =cut
68  
69 ### No user-serviceable part below this line ###
70  
71 sub get{
72 my $pkg = shift if ( $_[0] eq __PACKAGE__ ) or defined ref $_[0] ;
73 no strict 'refs';
74 my $rv = ${ *{ $pkg. '::' }->{ config } };
75 use strict 'refs';
76 if( @_ > 0 ){
77 while( $_ = shift @_ ){
78 if( defined $rv->{ $_ } ){
79 $rv = $rv->{ $_ };
80 } else {
81 $rv = undef;
82 last;
83 }
84 }
85 }
86 return $rv;
87 }
88  
89 1;