Subject: | Not a Hash Errors found... |
Date: | Thu, 8 Oct 2020 18:18:06 +0000 |
To: | "bug-BigIP-GTM-ParseConfig [...] rt.cpan.org" <bug-BigIP-GTM-ParseConfig [...] rt.cpan.org> |
From: | David Botham <david [...] botham.com> |
I found and fixed a couple of errors around Hashes in ParseConfig.pm:
1. At or about line 372, I updated the declaration for $parsed to indicate it is a hash ref:
my ( $obj, $key, $attr1, $attr2, $attr3 );
my $parsed = {};
2. At or about line 554, I updated the part where you put an array ref on the end of the 2nd attribute to add a hash key name for the aref, using the 3rd attribute as the key name/label (I think you intended this behavior).
else {
$parsed->{$obj}{$key}{$attr1}{$attr2}{$attr3} ||= [];
push @{ $parsed->{$obj}{$key}{$attr1}{$attr2}{$attr3} }, $1;
}
I am not all that familiar with GTM configuration files, so, I don't have a lot of good advice regarding approaches for parsing the configuration files. However, it seems that using named variables, such as $attr1 (2,3, etc..), will not scale if the GTM configuration files can have N layers / depth. I urge you to resist the temptation to turning off 'strict' and generating named variables on the fly :) Something like Parse::RecDescent (https://metacpan.org/pod/Parse::RecDescent) might be useful.
I have attached my updated version.
__
Thank you,
David Botham
770.309.0774
Message body not shown because it is not plain text.