App-Framework
view release on metacpan or search on metacpan
lib/App/Framework/Feature/Config.pm view on Meta::CPAN
{
$config_href = $config_href->{$name} ;
}
# now process from this point
my @config ;
if (ref($config_href) eq 'ARRAY')
{
@config = @$config_href ;
}
else
{
@config = ($config_href) ;
}
return @config ;
}
#----------------------------------------------------------------------------
=item B< raw_to_vals($href) >
Given a HASH ref containing hashes of full config entries, convert into a hash
of variable/value pairs
=cut
sub raw_to_vals
{
my $this = shift ;
my ($href) = @_ ;
# copy values
my %config ;
foreach my $key (keys %$href)
{
$this->_dbg_prt( [" + key=$key\n"] ) ;
# copy over just those key/scalar pairs
if (ref($href->{$key}) eq 'HASH')
{
$config{$key} = $href->{$key}{'value'} ;
my $val = $href->{$key}{'value'} || '';
$this->_dbg_prt( [" + $key = $val\n"] ) ;
}
}
return %config ;
}
#============================================================================================
# PRIVATE METHODS
#============================================================================================
# # TAG: authenticate_cache_garbage_interval
# # The time period between garbage collection across the username cache.
# # This is a tradeoff between memory utilization (long intervals - say
# # 2 days) and CPU (short intervals - say 1 minute). Only change if you
# # have good reason to.
# #
# #Default:
# # authenticate_cache_garbage_interval 1 hour
# authenticate_cache_garbage_interval 1 hour
# ## Path: Network/WWW/Apache2
# ## Description: Configuration for Apache 2
# ## Type: string
# ## Default: ""
# ## ServiceRestart: apache2
# #
# # Here you can name files, separated by spaces, that should be Include'd from
# # httpd.conf.
# #
# # This allows you to add e.g. VirtualHost statements without touching
# # /etc/apache2/httpd.conf itself, which makes upgrading easier.
# #
# APACHE_CONF_INCLUDE_FILES=""
#----------------------------------------------------------------------------
#
#=item B< _process($filename) >
#
#Read in the config file (located somewhere in the searchable path).
#
#Returns a HASH of the config.
#
#=cut
#
sub _process
{
my $this = shift ;
my ($filename) = @_ ;
my %config ;
my %sections ;
my @sections ;
my $order=1 ;
$this->_dbg_prt( ["Config: _process($filename)\n"] ) ;
open my $fh, "<$filename" or $this->throw_fatal("Feature:Config : unable to read file $filename : $!") ;
my $line ;
my %params ;
my $href = \%config ;
while (defined($line = <$fh>))
{
chomp $line ;
$this->_dbg_prt( [" + <$line>\n"] ) ;
$this->_dbg_prt( ["Params:", \%params] ) ;
$line =~ s/^\s+// ;
$line =~ s/\s+$// ;
unless ($line)
{
## Empty line, see if we were creating a new entry - if so, save it
if ($params{name})
( run in 2.661 seconds using v1.01-cache-2.11-cpan-d7a12ab2c7f )