mirror of
https://codeberg.org/scip/Config-General.git
synced 2025-12-16 20:21:01 +01:00
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:
18
Changelog
18
Changelog
@@ -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
|
||||
as meta escape char, but not if it appears on it's own,
|
||||
as it happens on windows platforms. Thanks to for finding
|
||||
|
||||
47
General.pm
47
General.pm
@@ -5,9 +5,9 @@
|
||||
# config values from a given file and
|
||||
# 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.
|
||||
# Artistic License, same as perl itself. Have fun.
|
||||
# Licensed under the Artistic License 2.0.
|
||||
#
|
||||
# namespace
|
||||
package Config::General;
|
||||
@@ -32,7 +32,7 @@ use Carp::Heavy;
|
||||
use Carp;
|
||||
use Exporter;
|
||||
|
||||
$Config::General::VERSION = "2.63";
|
||||
$Config::General::VERSION = "2.65";
|
||||
|
||||
use vars qw(@ISA @EXPORT_OK);
|
||||
use base qw(Exporter);
|
||||
@@ -339,7 +339,8 @@ sub _prepare {
|
||||
|
||||
if (exists $conf{-DefaultConfig}) {
|
||||
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()) {
|
||||
$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
|
||||
local *INCLUDEDIR;
|
||||
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;
|
||||
local $this->{CurrentConfigFilePath} = $configfile;
|
||||
for (@files) {
|
||||
@@ -832,29 +835,35 @@ sub _process_apache_ifdefine {
|
||||
my($this, $rawlines) = @_;
|
||||
|
||||
my @filtered;
|
||||
my $includeFlag = 1;
|
||||
my $blockLevel = 0;
|
||||
my @includeFlag = (1);
|
||||
|
||||
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
|
||||
# the DEF is known, otherwise skip it til end of IFDEF
|
||||
my ($negate, $define) = ($1 eq '!',$2);
|
||||
|
||||
$blockLevel++;
|
||||
$includeFlag &= ((not $negate) & (exists $this->{Define}{$define}));
|
||||
} elsif (/^<\s*\/IfDefine\s*>/i) {
|
||||
$blockLevel--;
|
||||
$includeFlag = $blockLevel == 0;
|
||||
} elsif ($includeFlag && /\s*Define\s+("[^"]+"|\S+)/i) {
|
||||
push(@includeFlag,
|
||||
$includeFlag[-1] &
|
||||
((not $negate) & (exists $this->{Define}{$define}))
|
||||
);
|
||||
}
|
||||
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
|
||||
$this->{Define}{$1} = 1;
|
||||
} elsif ($includeFlag) {
|
||||
}
|
||||
elsif ($includeFlag[-1]) {
|
||||
push @filtered, $_;
|
||||
}
|
||||
}
|
||||
|
||||
if ($blockLevel) {
|
||||
if (scalar(@includeFlag) > 1) {
|
||||
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
|
||||
|
||||
Copyright (c) 2000-2016 Thomas Linden
|
||||
Copyright (c) 2000-2022 Thomas Linden
|
||||
|
||||
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
|
||||
|
||||
@@ -2874,7 +2883,7 @@ Thomas Linden <tlinden |AT| cpan.org>
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
2.63
|
||||
2.65
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# 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.
|
||||
# Artistic License, same as perl itself. Have fun.
|
||||
# Licensed under the Artistic License 2.0.
|
||||
#
|
||||
|
||||
# namespace
|
||||
@@ -640,10 +640,10 @@ values under the given key will be overwritten.
|
||||
|
||||
=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
|
||||
modify it under the same terms as Perl itself.
|
||||
modify it under the terms of the Artistic License 2.0.
|
||||
|
||||
|
||||
=head1 BUGS
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
# Config::General::Interpolated - special Class based on Config::General
|
||||
#
|
||||
# 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.
|
||||
# Artistic License, same as perl itself. Have fun.
|
||||
# Licensed under the terms of the Artistic License 2.0.
|
||||
#
|
||||
|
||||
package Config::General::Interpolated;
|
||||
$Config::General::Interpolated::VERSION = "2.15";
|
||||
$Config::General::Interpolated::VERSION = "2.16";
|
||||
|
||||
use strict;
|
||||
use Carp;
|
||||
@@ -47,7 +47,7 @@ sub _set_regex {
|
||||
# but can't begin with a '\'
|
||||
\$ # dollar sign
|
||||
(\{)? # $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...
|
||||
\} # ... 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
|
||||
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
|
||||
|
||||
L<Config::General>
|
||||
@@ -340,16 +355,16 @@ L<Config::General>
|
||||
=head1 COPYRIGHT
|
||||
|
||||
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
|
||||
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>
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
2.15
|
||||
2.16
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
49
META.json
Normal file
49
META.json
Normal 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"
|
||||
}
|
||||
29
META.yml
29
META.yml
@@ -1,16 +1,27 @@
|
||||
---
|
||||
abstract: unknown
|
||||
author:
|
||||
- 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
|
||||
version: 2.58
|
||||
version_from: General.pm
|
||||
installdirs: site
|
||||
no_index:
|
||||
directory:
|
||||
- t
|
||||
- inc
|
||||
requires:
|
||||
File::Glob: 0
|
||||
File::Spec::Functions: 0
|
||||
FileHandle: 0
|
||||
IO::File: 0
|
||||
resources:
|
||||
bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=Config-General
|
||||
homepage: http://search.cpan.org/dist/Config-General/
|
||||
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
|
||||
repository: https://github.com/TLINDEN/Config-General
|
||||
version: 2.65
|
||||
|
||||
11
Makefile.PL
11
Makefile.PL
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# 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.
|
||||
# Artistic License, same as perl itself. Have fun.
|
||||
# Licensed under the Artistic License 2.0.
|
||||
#
|
||||
|
||||
use ExtUtils::MakeMaker;
|
||||
@@ -22,10 +22,9 @@ WriteMakefile(
|
||||
},
|
||||
'META_MERGE' => {
|
||||
resources => {
|
||||
repository => 'http://dev.catalyst.perl.org/repos/Config-General/trunk/',
|
||||
repository => 'https://github.com/TLINDEN/Config-General'
|
||||
},
|
||||
},
|
||||
($ExtUtils::MakeMaker::VERSION ge '6.31'?
|
||||
('LICENSE' => 'perl', ) : ()),
|
||||
);
|
||||
|
||||
('LICENSE' => 'artistic_2', ) : ()),
|
||||
);
|
||||
|
||||
8
README
8
README
@@ -80,14 +80,14 @@ UPDATE
|
||||
COPYRIGHT
|
||||
Config::General
|
||||
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
|
||||
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
|
||||
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
|
||||
|
||||
@@ -104,4 +104,4 @@ AUTHOR
|
||||
|
||||
|
||||
VERSION
|
||||
2.63
|
||||
2.65
|
||||
|
||||
Reference in New Issue
Block a user