mirror of
https://codeberg.org/scip/Config-General.git
synced 2025-12-16 20:21:01 +01:00
1.20: - added an if(exists... to new() for checking of the
existence of -AllowMultiOptions.
- use now "local $_" because it caused weird results
if a user used $_ with the module.
git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@8 be1acefe-a474-0410-9a34-9b3221f2030f
This commit is contained in:
20
General.pm
20
General.pm
@@ -10,6 +10,10 @@
|
|||||||
# All Rights Reserved. Std. disclaimer applies.
|
# All Rights Reserved. Std. disclaimer applies.
|
||||||
# Artificial License, same as perl itself. Have fun.
|
# Artificial License, same as perl itself. Have fun.
|
||||||
#
|
#
|
||||||
|
# Changes from 1.19: - added an if(exists... to new() for checking of the
|
||||||
|
# existence of -AllowMultiOptions.
|
||||||
|
# - use now "local $_" because it caused weird results
|
||||||
|
# if a user used $_ with the module.
|
||||||
# Changes from 1.18: - you can escape "#" characters using a backslash: "\#"
|
# Changes from 1.18: - you can escape "#" characters using a backslash: "\#"
|
||||||
# which will now no more treated as a comment.
|
# which will now no more treated as a comment.
|
||||||
# - comments inside here-documents will now remain in the
|
# - comments inside here-documents will now remain in the
|
||||||
@@ -22,7 +26,7 @@ use FileHandle;
|
|||||||
use strict;
|
use strict;
|
||||||
use Carp;
|
use Carp;
|
||||||
|
|
||||||
$Config::General::VERSION = "1.19";
|
$Config::General::VERSION = "1.20";
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
#
|
#
|
||||||
@@ -41,8 +45,10 @@ sub new {
|
|||||||
my %conf = @param;
|
my %conf = @param;
|
||||||
$configfile = delete $conf{-file} if(exists $conf{-file});
|
$configfile = delete $conf{-file} if(exists $conf{-file});
|
||||||
$configfile = delete $conf{-hash} if(exists $conf{-hash});
|
$configfile = delete $conf{-hash} if(exists $conf{-hash});
|
||||||
if ($conf{-AllowMultiOptions} =~ /^no$/) {
|
if (exists $conf{-AllowMultiOptions} ) {
|
||||||
$self->{NoMultiOptions} = 1;
|
if ($conf{-AllowMultiOptions} =~ /^no$/) {
|
||||||
|
$self->{NoMultiOptions} = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elsif ($#param == 0) {
|
elsif ($#param == 0) {
|
||||||
@@ -92,7 +98,7 @@ sub _open {
|
|||||||
#
|
#
|
||||||
my($this, $configfile) = @_;
|
my($this, $configfile) = @_;
|
||||||
my(@content, $c_comment, $longline, $hier, $hierend, @hierdoc);
|
my(@content, $c_comment, $longline, $hier, $hierend, @hierdoc);
|
||||||
|
local $_;
|
||||||
my $fh = new FileHandle;
|
my $fh = new FileHandle;
|
||||||
|
|
||||||
if (-e $configfile) {
|
if (-e $configfile) {
|
||||||
@@ -183,7 +189,7 @@ sub _parse {
|
|||||||
#
|
#
|
||||||
my($this, $config, $content) = @_;
|
my($this, $config, $content) = @_;
|
||||||
my(@newcontent, $block, $blockname, $grab, $chunk,$block_level);
|
my(@newcontent, $block, $blockname, $grab, $chunk,$block_level);
|
||||||
|
local $_;
|
||||||
foreach (@{$content}) { # loop over content stack
|
foreach (@{$content}) { # loop over content stack
|
||||||
chomp;
|
chomp;
|
||||||
$chunk++;
|
$chunk++;
|
||||||
@@ -297,7 +303,7 @@ sub _store {
|
|||||||
# internal sub for saving a block
|
# internal sub for saving a block
|
||||||
#
|
#
|
||||||
my($this, $fh, $level, %config) = @_;
|
my($this, $fh, $level, %config) = @_;
|
||||||
|
local $_;
|
||||||
my $indent = " " x $level;
|
my $indent = " " x $level;
|
||||||
|
|
||||||
foreach my $entry (sort keys %config) {
|
foreach my $entry (sort keys %config) {
|
||||||
@@ -733,7 +739,7 @@ Thomas Linden <tom@daemon.de>
|
|||||||
|
|
||||||
=head1 VERSION
|
=head1 VERSION
|
||||||
|
|
||||||
1.19
|
1.20
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user