@@ -10,6 +10,7 @@ our $VERSION = '0.025';
1010use 5.020; # for unicode_strings, signatures, postderef features
1111use stable 0.031 ' postderef' ;
1212use experimental 0.026 qw( signatures args_array_with_signatures) ;
13+ no autovivification warn => qw( fetch store exists delete) ;
1314use if " $] " >= 5.022, experimental => ' re_strict' ;
1415no if " $] " >= 5.031009, feature => ' indirect' ;
1516no if " $] " >= 5.033001, feature => ' multidimensional' ;
@@ -146,10 +147,13 @@ sub _eval_subschema ($data, $schema, $state) {
146147 # if any of them are absolute prefix of this schema location, we are in a loop.
147148 my $canonical_uri = canonical_uri($state );
148149 my $schema_location = $state -> {traversed_schema_path }.$state -> {schema_path };
149- abort($state , ' EXCEPTION: infinite loop detected (same location evaluated twice)' )
150- if grep substr ($schema_location , 0, length ) eq $_ ,
151- keys $state -> {seen }{$state -> {data_path }}{$canonical_uri }-> %*;
152- $state -> {seen }{$state -> {data_path }}{$canonical_uri }{$schema_location }++;
150+ {
151+ use autovivification qw( fetch store) ;
152+ abort($state , ' EXCEPTION: infinite loop detected (same location evaluated twice)' )
153+ if grep substr ($schema_location , 0, length ) eq $_ ,
154+ keys $state -> {seen }{$state -> {data_path }}{$canonical_uri }-> %*;
155+ $state -> {seen }{$state -> {data_path }}{$canonical_uri }{$schema_location }++;
156+ }
153157
154158 my $schema_type = get_type($schema );
155159 return $schema || E($state , ' subschema is false' ) if $schema_type eq ' boolean' ;
@@ -211,7 +215,7 @@ sub _eval_subschema ($data, $schema, $state) {
211215 }
212216
213217 # check for previously-supported but now removed keywords
214- foreach my $keyword (sort keys $removed_keywords {$spec_version }-> %*) {
218+ foreach my $keyword (sort keys (( $removed_keywords {$spec_version }//{}) -> %*) ) {
215219 next if not exists $schema -> {$keyword };
216220 my $message =' no-longer-supported "' .$keyword .' " keyword present (at location "'
217221 .canonical_uri($state ).' ")' ;
0 commit comments