}
}
}
+
sub doLoadDataFile { my ($self,$e,$v)=@_;
my ($path,$cnf_file) = ("",$self->{CNF_CONTENT});
- $v=~s/\s+//g;
- if(! -e $v){
+ $v=~s/\s+//g;
+ if ($v eq '$0'){
+ $path = $0; $path =~ m/.*\/(.*)\..*$/ ; $path = $ENV{HOME}."/.config/$1.cnf";
+ if( -e $path ){
+ $self ->parse($path)
+ }else{
+ $self->warn("Skipping conventional local config file is missing: $path")
+ }
+ return;
+ }
+ elsif(! -e $v){
$path = substr($path, 0, rindex($cnf_file,'/')) .'/'.$v;
}else{
$path = $v;
sub parse { my ($self, $cnf_file, $content, $del_keys) = @_;
# We control from here the constances, as we need to unlock them if a previous parse was run.
- unlock_hash(%$self);
+ unlock_hash(%$self); my $recursing = 0;
if( not $content ){
$cnf_file = $cnf_file -> {path} if ref($cnf_file) eq 'CNFGlobalFile';
or CNFParserException->throw(error=>"Can't open $cnf_file -> $!",show_trace=>$self->{STACK_TRACE});
read $fh, $content, -s $fh;
close $fh;
- my @stat = stat($cnf_file);
- $self->{CNF_STAT} = \@stat;
- $self->{CNF_CONTENT} = $CUR_SCRIPT = $cnf_file;
+ if(!$self->{CNF_CONTENT} eq 'script'){
+ my @stat = stat($cnf_file);
+ $self->{CNF_STAT} = \@stat;
+ $self->{CNF_CONTENT} = $CUR_SCRIPT = $cnf_file;
+ }else{$recursing = 1}
}else{
my $type = Scalar::Util::reftype($content);
if($type && $type eq 'ARRAY'){
foreach my $k(@$del_keys){
delete $self->{$k} if exists $self->{$k}
}
+
+ return if $recursing;
my $runProcessors = $self->{RUN_PROCESSORS} ? 1: 0;
$self = lock_hash(%$self);#Make repository finally immutable.
runPostParseProcessors($self) if $runProcessors;