6
# Checks that the following relationships hold set-wise (e.g. ignoring order):
8
# keys($self->{v}) = $self->{sects}
10
# And for every section $sect:
12
# keys($self->{v}{sect}) = $self->{v}{params}
14
# This should be the case whenever control flows outside this module. Croaks
16
sub Config::IniFiles::_assert_invariants {
19
foreach my $sect (@{$self->{sects}}) {
20
croak "Non-lowercase section $sect" if ($self->{nocase} &&
21
(lc($sect) ne $sect));
24
foreach my $sect (keys %{$self->{v}}) {
25
croak "Key $sect in \$self->{v} and not in \$self->{sects}" unless
28
grep { croak "Key $_ in \$self->{sects} and not in in \$self->{v}" unless
29
$set{$_} eq 2 } (keys %set);
31
foreach my $sect (@{$self->{sects}}) {
34
foreach my $parm (@{$self->{parms}{$sect}}) {
35
croak "Non-lowercase parameter $parm" if ($self->{nocase} &&
36
(lc($parm) ne $parm));
39
foreach my $parm (keys %{$self->{v}{$sect}}) {
40
croak "Key $parm in \$self->{v}{'$sect'} and not in \$self->{parms}{'$sect'}"
41
unless ($set{$parm}++);
43
grep { croak "Key $_ in \$self->{parms}{'$sect'} and not in in \$self->{v}{'$sect'}"
44
unless $set{$_} eq 2 } (keys %set);