Move from svn to github and various fixes:

-    fix rt.cpan.org#142095:IfDefine refined
-    fix rt.cpan.org#118746:clarify variable name chars
-    fix rt.cpan.org#139261: include dirs
-    fixed license to artistic_2
-    fix repo+version
This commit is contained in:
2022-04-12 13:07:51 +02:00
parent a4e206b66a
commit 6131988cd8
8 changed files with 189 additions and 88 deletions

View File

@@ -1,3 +1,21 @@
2.65 - fix rt.cpan.org#132893: clarified license, now licensed
under the Artistic License 2.0.
- fix rt.cpan.org#139261: correctly include directories.
- fix rt.cpan.org#118746: remove the comma from legal
variable names, added mandatory start characters a-zA-Z0-9,
added a section in the POD to clarify this.
- fix rt.cpan.org#119160: fix IfDefine code. Thanks for the patch.
2.64 - fix rt.cpan.org#142095: copy default hash, avoid modification.
- the Catalyst folks who hosted the source of this module
closed or moved the repository, I have not been informed and
have therefore lost all history of the module. So I moved
to github (https://github.com/TLINDEN/Config-General).
Thanks for nothing, Catalyst.
2.63 - fix for rt.cpan.org#116340: do only consider a backslash 2.63 - fix for rt.cpan.org#116340: do only consider a backslash
as meta escape char, but not if it appears on it's own, as meta escape char, but not if it appears on it's own,
as it happens on windows platforms. Thanks to for finding as it happens on windows platforms. Thanks to for finding

View File

@@ -5,9 +5,9 @@
# config values from a given file and # config values from a given file and
# return it as hash structure # return it as hash structure
# #
# Copyright (c) 2000-2016 Thomas Linden <tlinden |AT| cpan.org>. # Copyright (c) 2000-2022 Thomas Linden <tlinden |AT| cpan.org>.
# All Rights Reserved. Std. disclaimer applies. # All Rights Reserved. Std. disclaimer applies.
# Artistic License, same as perl itself. Have fun. # Licensed under the Artistic License 2.0.
# #
# namespace # namespace
package Config::General; package Config::General;
@@ -32,7 +32,7 @@ use Carp::Heavy;
use Carp; use Carp;
use Exporter; use Exporter;
$Config::General::VERSION = "2.63"; $Config::General::VERSION = "2.65";
use vars qw(@ISA @EXPORT_OK); use vars qw(@ISA @EXPORT_OK);
use base qw(Exporter); use base qw(Exporter);
@@ -339,7 +339,8 @@ sub _prepare {
if (exists $conf{-DefaultConfig}) { if (exists $conf{-DefaultConfig}) {
if ($conf{-DefaultConfig} && ref($conf{-DefaultConfig}) eq 'HASH') { if ($conf{-DefaultConfig} && ref($conf{-DefaultConfig}) eq 'HASH') {
$self->{DefaultConfig} = $conf{-DefaultConfig}; # copy the hashref so that it is not being modified by subsequent calls, fixes bug#142095
$self->{DefaultConfig} = $self->_copy($conf{-DefaultConfig});
} }
elsif ($conf{-DefaultConfig} && ref($conf{-DefaultConfig}) eq q()) { elsif ($conf{-DefaultConfig} && ref($conf{-DefaultConfig}) eq q()) {
$self->_read($conf{-DefaultConfig}, 'SCALAR'); $self->_read($conf{-DefaultConfig}, 'SCALAR');
@@ -516,7 +517,9 @@ sub _open {
# A directory was included; include all the files inside that directory in ASCII order # A directory was included; include all the files inside that directory in ASCII order
local *INCLUDEDIR; local *INCLUDEDIR;
opendir INCLUDEDIR, $configfile or croak "Config::General: Could not open directory $configfile!($!)\n"; opendir INCLUDEDIR, $configfile or croak "Config::General: Could not open directory $configfile!($!)\n";
my @files = sort grep { -f catfile($configfile, $_) } catfile($configfile, $_), readdir INCLUDEDIR; #my @files = sort grep { -f catfile($configfile, $_) } catfile($configfile, $_), readdir INCLUDEDIR;
# fixes rt.cpan.org#139261
my @files = sort grep { -f catfile($configfile, $_) } readdir INCLUDEDIR;
closedir INCLUDEDIR; closedir INCLUDEDIR;
local $this->{CurrentConfigFilePath} = $configfile; local $this->{CurrentConfigFilePath} = $configfile;
for (@files) { for (@files) {
@@ -832,29 +835,35 @@ sub _process_apache_ifdefine {
my($this, $rawlines) = @_; my($this, $rawlines) = @_;
my @filtered; my @filtered;
my $includeFlag = 1; my @includeFlag = (1);
my $blockLevel = 0;
foreach (@{$rawlines}) { foreach (@{$rawlines}) {
if (/^<\s*IfDefine\s+([!]*)("[^"]+"|\S+)\s*>/i) { if (/^\s*<\s*IfDefine\s+([!]*)("[^"]+"|\S+)\s*>/i) {
# new IFDEF block, mark following content to be included if # new IFDEF block, mark following content to be included if
# the DEF is known, otherwise skip it til end of IFDEF # the DEF is known, otherwise skip it til end of IFDEF
my ($negate, $define) = ($1 eq '!',$2); my ($negate, $define) = ($1 eq '!',$2);
$blockLevel++; push(@includeFlag,
$includeFlag &= ((not $negate) & (exists $this->{Define}{$define})); $includeFlag[-1] &
} elsif (/^<\s*\/IfDefine\s*>/i) { ((not $negate) & (exists $this->{Define}{$define}))
$blockLevel--; );
$includeFlag = $blockLevel == 0; }
} elsif ($includeFlag && /\s*Define\s+("[^"]+"|\S+)/i) { elsif (/^\s*<\s*\/IfDefine\s*>/i) {
if (scalar(@includeFlag) <= 1) {
croak qq(Config::General: </IfDefine> without a <IfDefine>!\n);
}
pop(@includeFlag);
}
elsif ($includeFlag[-1] && /^\s*Define\s+("[^"]+"|\S+)/i) {
# inline Define, add it to our list # inline Define, add it to our list
$this->{Define}{$1} = 1; $this->{Define}{$1} = 1;
} elsif ($includeFlag) { }
elsif ($includeFlag[-1]) {
push @filtered, $_; push @filtered, $_;
} }
} }
if ($blockLevel) { if (scalar(@includeFlag) > 1) {
croak qq(Config::General: Block <IfDefine> has no EndBlock statement!\n); croak qq(Config::General: Block <IfDefine> has no EndBlock statement!\n);
} }
@@ -2845,10 +2854,10 @@ I recommend you to read the following documents, which are supplied with Perl:
=head1 LICENSE AND COPYRIGHT =head1 LICENSE AND COPYRIGHT
Copyright (c) 2000-2016 Thomas Linden Copyright (c) 2000-2022 Thomas Linden
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself. modify it under the same terms of the Artistic License 2.0.
=head1 BUGS AND LIMITATIONS =head1 BUGS AND LIMITATIONS
@@ -2874,7 +2883,7 @@ Thomas Linden <tlinden |AT| cpan.org>
=head1 VERSION =head1 VERSION
2.63 2.65
=cut =cut

View File

@@ -1,9 +1,9 @@
# #
# Config::General::Extended - special Class based on Config::General # Config::General::Extended - special Class based on Config::General
# #
# Copyright (c) 2000-2014 Thomas Linden <tlinden |AT| cpan.org>. # Copyright (c) 2000-2022 Thomas Linden <tlinden |AT| cpan.org>.
# All Rights Reserved. Std. disclaimer applies. # All Rights Reserved. Std. disclaimer applies.
# Artistic License, same as perl itself. Have fun. # Licensed under the Artistic License 2.0.
# #
# namespace # namespace
@@ -96,33 +96,33 @@ sub obj {
elsif (ref($this->{config}->{$key}) eq "ARRAY") { elsif (ref($this->{config}->{$key}) eq "ARRAY") {
my @objlist; my @objlist;
foreach my $element (@{$this->{config}->{$key}}) { foreach my $element (@{$this->{config}->{$key}}) {
if (ref($element) eq "HASH") { if (ref($element) eq "HASH") {
push @objlist, push @objlist,
$this->SUPER::new( -ExtendedAccess => 1, $this->SUPER::new( -ExtendedAccess => 1,
-ConfigHash => $element, -ConfigHash => $element,
%{$this->{Params}} ); %{$this->{Params}} );
} }
else { else {
if ($this->{StrictObjects}) { if ($this->{StrictObjects}) {
croak "element in list \"$key\" does not point to a hash reference!\n"; croak "element in list \"$key\" does not point to a hash reference!\n";
} }
# else: skip this element # else: skip this element
} }
} }
return \@objlist; return \@objlist;
} }
elsif (ref($this->{config}->{$key}) eq "HASH") { elsif (ref($this->{config}->{$key}) eq "HASH") {
return $this->SUPER::new( -ExtendedAccess => 1, return $this->SUPER::new( -ExtendedAccess => 1,
-ConfigHash => $this->{config}->{$key}, %{$this->{Params}} ); -ConfigHash => $this->{config}->{$key}, %{$this->{Params}} );
} }
else { else {
# nothing supported # nothing supported
if ($this->{StrictObjects}) { if ($this->{StrictObjects}) {
croak "key \"$key\" does not point to a hash reference!\n"; croak "key \"$key\" does not point to a hash reference!\n";
} }
else { else {
# be cool, create an empty object! # be cool, create an empty object!
return $empty; return $empty;
} }
} }
} }
@@ -148,10 +148,10 @@ sub value {
} }
else { else {
if ($this->{StrictObjects}) { if ($this->{StrictObjects}) {
croak "Key \"$key\" does not exist within current object\n"; croak "Key \"$key\" does not exist within current object\n";
} }
else { else {
return ""; return "";
} }
} }
} }
@@ -640,10 +640,10 @@ values under the given key will be overwritten.
=head1 COPYRIGHT =head1 COPYRIGHT
Copyright (c) 2000-2014 Thomas Linden Copyright (c) 2000-2022 Thomas Linden
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself. modify it under the terms of the Artistic License 2.0.
=head1 BUGS =head1 BUGS

View File

@@ -2,13 +2,13 @@
# Config::General::Interpolated - special Class based on Config::General # Config::General::Interpolated - special Class based on Config::General
# #
# Copyright (c) 2001 by Wei-Hon Chen <plasmaball@pchome.com.tw>. # Copyright (c) 2001 by Wei-Hon Chen <plasmaball@pchome.com.tw>.
# Copyright (c) 2000-2014 by Thomas Linden <tlinden |AT| cpan.org>. # Copyright (c) 2000-2022 by Thomas Linden <tlinden |AT| cpan.org>.
# All Rights Reserved. Std. disclaimer applies. # All Rights Reserved. Std. disclaimer applies.
# Artistic License, same as perl itself. Have fun. # Licensed under the terms of the Artistic License 2.0.
# #
package Config::General::Interpolated; package Config::General::Interpolated;
$Config::General::Interpolated::VERSION = "2.15"; $Config::General::Interpolated::VERSION = "2.16";
use strict; use strict;
use Carp; use Carp;
@@ -47,7 +47,7 @@ sub _set_regex {
# but can't begin with a '\' # but can't begin with a '\'
\$ # dollar sign \$ # dollar sign
(\{)? # $2: optional opening curly (\{)? # $2: optional opening curly
([a-zA-Z0-9_\-\.:\+,]+) # $3: capturing variable name (fix of #33447) ([a-zA-Z0-9][a-zA-Z0-9_\-\.:\+]*) # $3: capturing variable name (fix of #33447+118746)
(?(2) # $4: if there's the opening curly... (?(2) # $4: if there's the opening curly...
\} # ... match closing curly \} # ... match closing curly
) )
@@ -327,6 +327,21 @@ behavior as you know of Perl itself.
In addition you can surround variable names with curly braces to In addition you can surround variable names with curly braces to
avoid misinterpretation by the parser. avoid misinterpretation by the parser.
=head1 NAMING CONVENTIONS
Variable names must:
=over
=item * start with a US-ASCII letter(a-z or A-Z) or a digit (0-9).
=item * contain only US-ASCII letter(a-z or A-Z), digits (0-9), the dash (-)
colon (:), dot (.), underscore (_) and plus (+) characters.
=back
For added clarity variable names can be surrounded by curly braces.
=head1 SEE ALSO =head1 SEE ALSO
L<Config::General> L<Config::General>
@@ -340,16 +355,16 @@ L<Config::General>
=head1 COPYRIGHT =head1 COPYRIGHT
Copyright 2001 by Wei-Hon Chen E<lt>plasmaball@pchome.com.twE<gt>. Copyright 2001 by Wei-Hon Chen E<lt>plasmaball@pchome.com.twE<gt>.
Copyright 2002-2014 by Thomas Linden <tlinden |AT| cpan.org>. Copyright 2002-2022 by Thomas Linden <tlinden |AT| cpan.org>.
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself. modify it under the terms of the Artistic License 2.0.
See L<http://www.perl.com/perl/misc/Artistic.html> See L<http://www.perl.com/perl/misc/Artistic.html>
=head1 VERSION =head1 VERSION
2.15 2.16
=cut =cut

49
META.json Normal file
View File

@@ -0,0 +1,49 @@
{
"abstract" : "unknown",
"author" : [
"unknown"
],
"dynamic_config" : 1,
"generated_by" : "ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.130880",
"license" : [
"artistic_2"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : "2"
},
"name" : "Config-General",
"no_index" : {
"directory" : [
"t",
"inc"
]
},
"prereqs" : {
"build" : {
"requires" : {
"ExtUtils::MakeMaker" : "0"
}
},
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "0"
}
},
"runtime" : {
"requires" : {
"File::Glob" : "0",
"File::Spec::Functions" : "0",
"FileHandle" : "0",
"IO::File" : "0"
}
}
},
"release_status" : "stable",
"resources" : {
"repository" : {
"url" : "https://github.com/TLINDEN/Config-General"
}
},
"version" : "2.65"
}

View File

@@ -1,16 +1,27 @@
name: Config-General ---
version: 2.58 abstract: unknown
version_from: General.pm author:
installdirs: site - unknown
build_requires:
ExtUtils::MakeMaker: 0
configure_requires:
ExtUtils::MakeMaker: 0
dynamic_config: 1
generated_by: 'ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.130880'
license: artistic_2
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
name: Config-General
no_index:
directory:
- t
- inc
requires: requires:
File::Glob: 0 File::Glob: 0
File::Spec::Functions: 0 File::Spec::Functions: 0
FileHandle: 0 FileHandle: 0
IO::File: 0 IO::File: 0
resources: resources:
bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=Config-General repository: https://github.com/TLINDEN/Config-General
homepage: http://search.cpan.org/dist/Config-General/ version: 2.65
license: http://dev.perl.org/licenses/artistic.html
repository: http://dev.catalyst.perl.org/repos/Config-General
distribution_type: module
generated_by: ExtUtils::MakeMaker version 6.30

View File

@@ -1,31 +1,30 @@
# #
# Makefile.PL - build file for Config::General # Makefile.PL - build file for Config::General
# #
# Copyright (c) 2000-2014 Thomas Linden <tom@daemon.de>. # Copyright (c) 2000-2022 Thomas Linden <tom@daemon.de>.
# All Rights Reserved. Std. disclaimer applies. # All Rights Reserved. Std. disclaimer applies.
# Artistic License, same as perl itself. Have fun. # Licensed under the Artistic License 2.0.
# #
use ExtUtils::MakeMaker; use ExtUtils::MakeMaker;
WriteMakefile( WriteMakefile(
'NAME' => 'Config::General', 'NAME' => 'Config::General',
'VERSION_FROM' => 'General.pm', 'VERSION_FROM' => 'General.pm',
'clean' => { 'clean' => {
FILES => 't/*.out t/test.cfg *~ */*~' FILES => 't/*.out t/test.cfg *~ */*~'
}, },
'PREREQ_PM' => { 'PREREQ_PM' => {
'IO::File' => 0, 'IO::File' => 0,
'FileHandle' => 0, 'FileHandle' => 0,
'File::Spec::Functions' => 0, 'File::Spec::Functions' => 0,
'File::Glob' => 0 'File::Glob' => 0
}, },
'META_MERGE' => { 'META_MERGE' => {
resources => { resources => {
repository => 'http://dev.catalyst.perl.org/repos/Config-General/trunk/', repository => 'https://github.com/TLINDEN/Config-General'
}, },
}, },
($ExtUtils::MakeMaker::VERSION ge '6.31'? ($ExtUtils::MakeMaker::VERSION ge '6.31'?
('LICENSE' => 'perl', ) : ()), ('LICENSE' => 'artistic_2', ) : ()),
); );

8
README
View File

@@ -80,14 +80,14 @@ UPDATE
COPYRIGHT COPYRIGHT
Config::General Config::General
Config::General::Extended Config::General::Extended
Copyright (c) 2000-2015 by Thomas Linden <tom@daemon.de> Copyright (c) 2000-2022 by Thomas Linden <tom@daemon.de>
Config::General::Interpolated Config::General::Interpolated
Copyright (c) 2001 by Wei-Hon Chen <plasmaball@pchome.com.tw> Copyright (c) 2001 by Wei-Hon Chen <plasmaball@pchome.com.tw>
Copyright (c) 2002-2014 by Thomas Linden <tom@daemon.de>. Copyright (c) 2002-2022 by Thomas Linden <tom@daemon.de>.
This library is free software; you can redistribute it This library is free software; you can redistribute it
and/or modify it under the same terms as Perl itself. and/or modify it under the terms of the Artistic 2.0 license.
HOMEPAGE HOMEPAGE
@@ -104,4 +104,4 @@ AUTHOR
VERSION VERSION
2.63 2.65