+if (exists $options{invalidate_state}) {
+ for my $invalidate_state (@{$options{invalidate_state}}) {
+ my ($method,$database,$keyword) = split /,/, $invalidate_state;
+ if (grep {not defined $_ } ($method,$database,$keyword) ) {
+ print STDERR "The invalidate state option '$invalidate_state' is invalid.\n";
+ next;
+ }
+ if (not exists $state{done_keywords}{$method}) {
+ print STDERR "Method '$method' does not exist, and cannot be invalidated\n";
+ next;
+ }
+ if (not exists $state{done_keywords}{$method}{$database}) {
+ print STDERR "Database '$database' does not exist for method '$method', and cannot be invalidated\n";
+ next;
+ }
+ if (not length $keyword) {
+ delete $state{done_keywords}{$method}{$database};
+ if ($method eq 'get') {
+ delete $state{done_keywords}{parse}{$database};
+ delete $state{done_keywords}{combine}{$database};
+ }
+ if ($method eq 'parse') {
+ delete $state{done_keywords}{combine}{$database};
+ }
+ next;
+ }
+ if (not exists $state{done_keywords}{$method}{$database}{$keyword}) {
+ print STDERR "Keyword '$keyword' does not exist for database '$database' and method '$method', and cannot be invalidated\n";
+ next;
+ }
+ delete $state{done_keywords}{$method}{$database}{$keyword};
+ if ($method eq 'get') {
+ delete $state{done_keywords}{parse}{$database}{$keyword};
+ delete $state{done_keywords}{combine}{$database}{$keyword};
+ }
+ if ($method eq 'parse') {
+ delete $state{done_keywords}{combine}{$database}{$keyword};
+ }
+ }
+}
+