32 |
=cut |
=cut |
33 |
|
|
34 |
our %config; |
our %config; |
35 |
|
our $debug; |
|
sub debug { 1 }; |
|
36 |
|
|
37 |
sub load_config { |
sub load_config { |
38 |
my $self = shift; |
my $self = shift; |
39 |
|
$debug = $self->debug if $self->can('debug'); |
40 |
foreach my $name ( 'config', 'site_config', ref($self), @_ ) { |
foreach my $name ( 'config', 'site_config', ref($self), @_ ) { |
41 |
my $path = "etc/$name.yml"; |
my $path = "etc/$name.yml"; |
42 |
if ( $path =~ s{::}{/}g ) { |
if ( $path =~ s{::}{/}g ) { |
45 |
} else { |
} else { |
46 |
%config = %{ merge( LoadFile($path) , \%config ) } if -e $path; |
%config = %{ merge( LoadFile($path) , \%config ) } if -e $path; |
47 |
} |
} |
48 |
warn "## load_config $path current config = ",dump( %config ) if $self->debug; |
warn "## load_config $path current config = ",dump( %config ) if $debug; |
49 |
} |
} |
50 |
} |
} |
51 |
|
|