diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2019-08-27 12:43:59 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2019-08-27 12:44:25 +0300 |
commit | 058e552bd37c0acf9d3a10fc743ac4d76d579b45 (patch) | |
tree | 2e224f7df70c320cd68ffe06074ae0746b313e20 | |
parent | c10a4c4657b1b04d0c6059308f127368861b2fd2 (diff) | |
download | config-ast-058e552bd37c0acf9d3a10fc743ac4d76d579b45.tar.gz config-ast-058e552bd37c0acf9d3a10fc743ac4d76d579b45.tar.bz2 |
Provide DESTROY method along with AUTOLOADv1.03
-rw-r--r-- | Changes | 3 | ||||
-rw-r--r-- | lib/Config/AST.pm | 12 | ||||
-rw-r--r-- | lib/Config/AST/Follow.pm | 2 |
3 files changed, 12 insertions, 5 deletions
@@ -1,8 +1,11 @@ Revision history for Perl extension Config::AST +1.03 Tue Aug 27 12:37:00 2019 + - provide DESTROY methods along with AUTOLOADS + 1.02 Fri Aug 23 13:52:29 2019 - reimplement direct addressing in a more robust way 1.01 Tue Aug 20 17:01:07 2019 - fix repository url diff --git a/lib/Config/AST.pm b/lib/Config/AST.pm index adc65c2..837bbac 100644 --- a/lib/Config/AST.pm +++ b/lib/Config/AST.pm @@ -28,13 +28,13 @@ use Data::Dumper; require Exporter; our @ISA = qw(Exporter); our %EXPORT_TAGS = ( 'sort' => [ qw(NO_SORT SORT_NATURAL SORT_PATH) ] ); our @EXPORT_OK = qw(NO_SORT SORT_NATURAL SORT_PATH); -our $VERSION = "1.02"; +our $VERSION = "1.03"; =head1 NAME Config::AST - abstract syntax tree for configuration files =head1 SYNOPSIS @@ -188,13 +188,13 @@ keywords: Whether or not this setting is mandatory. =item default => I<VALUE> Default value for the setting. This value will be assigned if that particular -statement is not explicilty used in the configuration file. If I<VALUE> +statement is not explicitly used in the configuration file. If I<VALUE> is a CODE reference, it will be invoked as a method each time the value is accessed. Default values must be pure Perl values (not the values that should appear in the configuration file). They are not processed using the B<check> callbacks (see below). @@ -215,13 +215,13 @@ Reference to a method which will be called in order to decide whether to apply this hash to a particular configuration setting. The method is called as $self->$coderef($node, @path) where $node is the B<Config::AST::Node::Value> object (use -B<$vref-E<gt>value>, to obtain the actual value), and B<@path> is its patname. +B<$vref-E<gt>value>, to obtain the actual value), and B<@path> is its pathname. =item check => I<coderef> Defines a method which will be called after parsing the statement in order to verify its value. The I<coderef> is called as @@ -716,16 +716,18 @@ sub AUTOLOAD { my ($p, $m) = ($1, $2); croak "Can't locate object method \"$m\" via package \"$p\"" if @_ || !$self->lexicon; return Config::AST::Follow->new($self->tree, $self->lexicon)->${\$m}; } +sub DESTROY { } + =head1 CONSTRUCTING THE SYNTAX TREE The methods described in this section are intended for use by the parser -implementors. They should be called from the implementation of the B<parse> +implementers. They should be called from the implementation of the B<parse> method in order to construct the tree. =cut sub _section_lexicon { my ($self, $kw, $name) = @_; @@ -951,13 +953,13 @@ sub unset { my $loc = pop @path; $loc->[0]->delete($loc->[1]); last unless ($loc->[0]->keys == 0); } } -=head1 AUXILARY METHODS +=head1 AUXILIARY METHODS =head2 @array = $cfg->names_of(@path) If B<@path> refers to an existing configuration section, returns a list of names of variables and subsections defined within that section. Otherwise, returns empty list. For example, if you have diff --git a/lib/Config/AST/Follow.pm b/lib/Config/AST/Follow.pm index f98bba7..84d6a3d 100644 --- a/lib/Config/AST/Follow.pm +++ b/lib/Config/AST/Follow.pm @@ -116,7 +116,9 @@ sub AUTOLOAD { } $self->{_lex} = $lex; $self; } +sub DESTROY { } + 1; |