diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2019-08-27 16:43:29 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2019-08-27 16:43:29 +0300 |
commit | 9a94fbc91ce1c2cfeffc8a8cb0e874e31d9d6ecb (patch) | |
tree | 9ed66f7b4abb728808f861217f27de128317875c | |
parent | 915b6221ebbab067493e2f7bb73978f400209f09 (diff) | |
download | config-ast-9a94fbc91ce1c2cfeffc8a8cb0e874e31d9d6ecb.tar.gz config-ast-9a94fbc91ce1c2cfeffc8a8cb0e874e31d9d6ecb.tar.bz2 |
Two auxiliary methods
* lib/Config/AST.pm (error_count,success): New methods.
-rw-r--r-- | lib/Config/AST.pm | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/Config/AST.pm b/lib/Config/AST.pm index fb10569..275e902 100644 --- a/lib/Config/AST.pm +++ b/lib/Config/AST.pm | |||
@@ -415,6 +415,27 @@ sub commit { | |||
415 | return $self->{_error_count} == 0; | 415 | return $self->{_error_count} == 0; |
416 | } | 416 | } |
417 | 417 | ||
418 | =head2 $cfg->error_count | ||
419 | |||
420 | Returns total number of errors encountered during parsing. | ||
421 | |||
422 | =cut | ||
423 | |||
424 | sub error_count { shift->{_error_count} } | ||
425 | |||
426 | =head2 $cfg->success | ||
427 | |||
428 | Returns true if no errors were detected during parsing. | ||
429 | |||
430 | =cut | ||
431 | |||
432 | sub success { ! shift->error_count } | ||
433 | |||
434 | # Auxiliary function used in commit and lint. | ||
435 | # Arguments: | ||
436 | # $section - A Config::AST::Node::Section to start fixup at | ||
437 | # $params - Lexicon. | ||
438 | # @path - Path to $section | ||
418 | sub fixup_tree { | 439 | sub fixup_tree { |
419 | my ($self, $section, $params, @path) = @_; | 440 | my ($self, $section, $params, @path) = @_; |
420 | 441 | ||