Files
racalmas/lib/calcms/config.pm
Milan afa56e9e1e config cache issues
By default the configuration cached by the mod_perl2 instance.
You can disable cache by setting cache/config=0.
You should disable cache only if you have multiple calcms instances
running on the same mod_perl2 server with different configuration.

The Location of the configuration will be determined by config module
now.
2018-09-22 21:39:20 +02:00

41 lines
728 B
Perl

package config;
use warnings;
use strict;
use FindBin();
use Config::General();
use base 'Exporter';
our @EXPORT_OK = qw(get set);
my $config = undef;
sub set {
my $value = shift;
$config = $value;
return;
}
sub get {
my $filename = shift;
return $config if ( defined $config ) && ( $config->{cache}->{cache_config} == 1 );
my $configuration = Config::General->new(
-ConfigFile => $filename,
-UTF8 => 1
);
config::set( $configuration->{DefaultConfig}->{config} );
return $config;
}
sub getFromScriptLocation() {
FindBin::again();
my $configFile = $FindBin::Bin . '/config/config.cgi';
return config::get($configFile);
}
#do not delete last line
1;