File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 1
- Config-Processor version 0.04
1
+ Config-Processor version 0.03_02
2
2
========================
3
3
4
4
INSTALLATION
Original file line number Diff line number Diff line change @@ -4,12 +4,13 @@ use 5.008000;
4
4
use strict;
5
5
use warnings;
6
6
7
- our $VERSION = ' 0.04 ' ;
7
+ our $VERSION = ' 0.03_02 ' ;
8
8
9
9
use File::Spec;
10
10
use YAML::XS qw( LoadFile ) ;
11
11
use Cpanel::JSON::XS;
12
12
use Hash::Merge;
13
+ use Scalar::Util qw( refaddr ) ;
13
14
use Carp qw( croak ) ;
14
15
15
16
my %FILE_EXTENSIONS_MAP = (
@@ -56,6 +57,7 @@ sub new {
56
57
$self -> {_hash_merge } = Hash::Merge-> new( ' CONFIG_PRECEDENT' );
57
58
$self -> {_config } = undef ;
58
59
$self -> {_vars } = {};
60
+ $self -> {_seen_nodes } = {};
59
61
60
62
return $self ;
61
63
}
@@ -83,7 +85,8 @@ sub load {
83
85
$self -> {_config } = $self -> _build_tree(@config_sections );
84
86
$self -> _process_tree( $self -> {_config } );
85
87
86
- $self -> {_vars } = {};
88
+ $self -> {_vars } = {};
89
+ $self -> {_seen_nodes } = {};
87
90
88
91
return $self -> {_config };
89
92
}
@@ -183,6 +186,12 @@ sub _process_tree {
183
186
184
187
$_ [0] = $self -> _process_node( $_ [0] );
185
188
189
+ if ( my $node_addr = refaddr( $_ [0] ) ) {
190
+ return if $self -> {_seen_nodes }{$node_addr };
191
+
192
+ $self -> {_seen_nodes }{$node_addr } = 1;
193
+ }
194
+
186
195
if ( ref ( $_ [0] ) eq ' HASH' ) {
187
196
foreach ( values %{ $_ [0] } ) {
188
197
$self -> _process_tree($_ );
You can’t perform that action at this time.
0 commit comments