| 1 | package Puzzle::Config; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | our $VERSION = '0.18'; | |||||||||
| 4 | |||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use Params::Validate qw(:types);; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | ▶ | use base 'Class::Container'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 1 | __PACKAGE__->valid_params( | |||||||||
| 13 | debug => { parse => 'boolean', default => 0, type => BOOLEAN}, | ||||||||||
| 14 | debug_path => { parse => 'string', default => undef, type => SCALAR | UNDEF}, | ||||||||||
| 15 | cache => { parse => 'boolean', default => 0, type => BOOLEAN}, | ||||||||||
| 16 | frames => { parse => 'boolean', default => 0, type => BOOLEAN}, | ||||||||||
| 17 | frame_top_file => { parse => 'string', type => SCALAR | UNDEF, default => undef }, | ||||||||||
| 18 | frame_left_file => { parse => 'string', type => SCALAR | UNDEF, default => undef }, | ||||||||||
| 19 | frame_right_file => { parse => 'string', type => SCALAR | UNDEF, default => undef }, | ||||||||||
| 20 | frame_bottom_file => { parse => 'string', type => SCALAR | UNDEF, default => undef }, | ||||||||||
| 21 | exception_file => { parse => 'string', type => SCALAR | UNDEF, default => undef }, | ||||||||||
| 22 | base => { parse => 'string', type => SCALAR | UNDEF, default => undef }, | ||||||||||
| 23 | gids => { parse => 'list', type => ARRAYREF | UNDEF, default => qw/everybody/ }, | ||||||||||
| 24 | login => { parse => 'string', type => SCALAR | UNDEF, default => undef }, | ||||||||||
| 25 | namespace => { parse => 'string', type => SCALAR }, | ||||||||||
| 26 | description => { parse => 'string', type => SCALAR, default => '' }, | ||||||||||
| 27 | keywords => { parse => 'string', type => SCALAR, default => '' }, | ||||||||||
| 28 | db => { parse => 'hash', type => HASHREF}, | ||||||||||
| 29 | traslation => { parse => 'hash', type => HASHREF, optional => 1}, | ||||||||||
| 30 | page => { parse => 'hash', type => HASHREF | UNDEF, optional => 1}, | ||||||||||
| 31 | mail => { parse => 'hash', type => HASHREF, optional => 1, | ||||||||||
| 32 | default => {server => '', from => ''} }, | ||||||||||
| 33 | ); | ||||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | # all new valid_params are read&write methods | ||||||||||
| 37 | 1 | ▶ | use HTML::Mason::MethodMaker( | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 38 | 20 | read_write => [ map { [ $_ => __PACKAGE__->validation_spec->{$_} ] } | |||||||||
| 39 | 1 | keys(%{__PACKAGE__->allowed_params()}) | |||||||||
| 40 | ] | ||||||||||
| 41 | 1 | ); | |||||||||
| 42 | |||||||||||
| 43 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 44 | 0 | my $class = shift; | |||||||||
| 45 | 0 | my $self = $class->SUPER::new(@_); | |||||||||
| 46 | # compatibility with previous version where db connection | ||||||||||
| 47 | # was mandatory | ||||||||||
| 48 | 0 | ▶ | $self->db->{enabled} = 1 unless exists $self->db->{enabled}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | 0 | return $self; | |||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | 0 | ▶ | sub as_hashref { | ||||||||
|
Subroutine
as_hashref: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 53 | 0 | my $self = shift; | |||||||||
| 54 | 0 | my %ret = map {$_ => $self->{$_}} keys(%{__PACKAGE__->allowed_params()}); | |||||||||
| 55 | 0 | delete $ret{container}; | |||||||||
| 56 | 0 | return \%ret; | |||||||||
| 57 | } | ||||||||||
| 58 | |||||||||||
| 59 | 1 | 1; | |||||||||