r37873 - in /branches/upstream/libconfig-inihash-perl/current: Changes META.yml lib/Config/IniHash.pm
carnil-guest at users.alioth.debian.org
carnil-guest at users.alioth.debian.org
Mon Jun 8 19:31:59 UTC 2009
Author: carnil-guest
Date: Mon Jun 8 19:31:54 2009
New Revision: 37873
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=37873
Log:
[svn-upgrade] Integrating new upstream version, libconfig-inihash-perl (3.01.01)
Modified:
branches/upstream/libconfig-inihash-perl/current/Changes
branches/upstream/libconfig-inihash-perl/current/META.yml
branches/upstream/libconfig-inihash-perl/current/lib/Config/IniHash.pm
Modified: branches/upstream/libconfig-inihash-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-inihash-perl/current/Changes?rev=37873&op=diff
==============================================================================
--- branches/upstream/libconfig-inihash-perl/current/Changes (original)
+++ branches/upstream/libconfig-inihash-perl/current/Changes Mon Jun 8 19:31:54 2009
@@ -1,51 +1,54 @@
-Revision history for Perl extension Config::IniHash.
-
-2.0 Tue Jul 23 19:15:34 2002
- - first public version
-
-2.2 Thu Dec 5 2002
- - some fixes and tuneups
-
-2.3 Sun Jan 5 2003
- - Makefile.PL and use statement fixes
-
-2.4 Wed Jan 29 2003
- - added sectionorder option
- - section names are now subject to tolower/toupper as well
- - minor fixes
-
-2.6
- - some -w related fixes
- - fixed %varname% handling
- - WriteIni uses the section order
-
-2.7 Fri Nov 05 2004
- - fixed WriteINI's handling of multiline values
-
-2.8 Sun Feb 20 2005
- - you may specify what hash to take the %varname%s from
- - you may specify what do comments look like
-
-2.8.2 Thu Jan 25 2007
- - added IO::Scalar to prerequisities to silence test errors in some environments
- - added the key name to the generated heredoc marks
-
-3.00.02 Sun Jan 11 2009
- - fixed the interoperation of case and sectionorder
- - added ability to tie the hashes to custom classes
- - added lots of tests
-
-3.00.03 Sun Jan 18 2009
- - fixed the test to work on Unixes (the TEMP variable was not defined and %ENV is case sensitive under Unix)
-
-3.00.04 Mon Jan 19 2009
- - erm. hopefully the test script finaly works under unix
-
-3.00.05 Mon Jan 26 2009
- - erm. hopefully the test script finaly works under unix
- - it now doesn't attempt to create files in the temp directory
-
-3.01.00 Thu May 28 2009
- - added the layer=> option to allow you to specify the IO layers used to open the file
- - add :utf8 layer automaticaly for files starting with BOM
- - add :crlf layer for files containing CRLF if needed
+Revision history for Perl extension Config::IniHash.
+
+2.0 Tue Jul 23 19:15:34 2002
+ - first public version
+
+2.2 Thu Dec 5 2002
+ - some fixes and tuneups
+
+2.3 Sun Jan 5 2003
+ - Makefile.PL and use statement fixes
+
+2.4 Wed Jan 29 2003
+ - added sectionorder option
+ - section names are now subject to tolower/toupper as well
+ - minor fixes
+
+2.6
+ - some -w related fixes
+ - fixed %varname% handling
+ - WriteIni uses the section order
+
+2.7 Fri Nov 05 2004
+ - fixed WriteINI's handling of multiline values
+
+2.8 Sun Feb 20 2005
+ - you may specify what hash to take the %varname%s from
+ - you may specify what do comments look like
+
+2.8.2 Thu Jan 25 2007
+ - added IO::Scalar to prerequisities to silence test errors in some environments
+ - added the key name to the generated heredoc marks
+
+3.00.02 Sun Jan 11 2009
+ - fixed the interoperation of case and sectionorder
+ - added ability to tie the hashes to custom classes
+ - added lots of tests
+
+3.00.03 Sun Jan 18 2009
+ - fixed the test to work on Unixes (the TEMP variable was not defined and %ENV is case sensitive under Unix)
+
+3.00.04 Mon Jan 19 2009
+ - erm. hopefully the test script finaly works under unix
+
+3.00.05 Mon Jan 26 2009
+ - erm. hopefully the test script finaly works under unix
+ - it now doesn't attempt to create files in the temp directory
+
+3.01.00 Thu May 28 2009
+ - added the layer=> option to allow you to specify the IO layers used to open the file
+ - add :utf8 layer automaticaly for files starting with BOM
+ - add :crlf layer for files containing CRLF if needed
+
+3.01.01 Mon Jun 8 2009
+ - fix a bug with repeated sections
Modified: branches/upstream/libconfig-inihash-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-inihash-perl/current/META.yml?rev=37873&op=diff
==============================================================================
--- branches/upstream/libconfig-inihash-perl/current/META.yml (original)
+++ branches/upstream/libconfig-inihash-perl/current/META.yml Mon Jun 8 19:31:54 2009
@@ -1,6 +1,6 @@
---
name: Config-IniHash
-version: 3.01.00
+version: 3.01.01
author:
- 'Jenda Krynicky <Jenda at Krynicky.cz>'
abstract: Perl extension for reading and writing INI files
@@ -13,7 +13,7 @@
provides:
Config::IniHash:
file: lib/Config/IniHash.pm
- version: 3.01.00
+ version: 3.01.01
Hash::Case::LowerX:
file: lib/Config/IniHash.pm
generated_by: Module::Build version 0.2808
Modified: branches/upstream/libconfig-inihash-perl/current/lib/Config/IniHash.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-inihash-perl/current/lib/Config/IniHash.pm?rev=37873&op=diff
==============================================================================
--- branches/upstream/libconfig-inihash-perl/current/lib/Config/IniHash.pm (original)
+++ branches/upstream/libconfig-inihash-perl/current/lib/Config/IniHash.pm Mon Jun 8 19:31:54 2009
@@ -12,7 +12,7 @@
@ISA = qw(Exporter);
@EXPORT = qw(&ReadINI &WriteINI &PrintINI);
@EXPORT_OK = qw(&ReadINI &WriteINI &PrintINI &AddDefaults &ReadSection);
-$VERSION = '3.01.00';
+$VERSION = '3.01.01';
if (0) { # for PerlApp/PerlSvc/PerlCtrl/Perl2Exe
require 'Hash/WithDefaults.pm';
@@ -149,7 +149,7 @@
}
sub ReadINI {
- my $file = shift;
+ my $file = shift;
my %opt;
if (@_ == 1 and ref $_[0]) {
%opt = %{$_[0]};
@@ -160,7 +160,7 @@
}
prepareOpt(\%opt);
- my $hash;
+ my $hash;
if ($opt{hash}) {
$hash = $opt{hash};
} else {
@@ -169,7 +169,7 @@
if $opt{class};
}
- my $section = '';
+ my $section = '';
my $IN;
if (ref $file) {
my $ref = ref $file;
@@ -229,32 +229,29 @@
}
my $forValue = $opt{forValue};
- while (<$IN>) {
-
-#use Encode qw(is_utf8);
-#print $_, " - is_utf8=" . is_utf8($_) . "\n";
-
- $_ =~ $opt{comment} and next;
-
- if (/^\[(.*)\]/) {
- $section = $1;
+ while (<$IN>) {
+
+ $_ =~ $opt{comment} and next;
+
+ if (/^\[(.*)\]/) {
+ $section = $1;
$opt{sectionorder}->($section) if $opt{sectionorder};
if ($lc) { $section = lc $section} elsif ($uc) { $section = uc $section };
- unless ($hash->{$section}) {
- my %tmp = ();
+ unless ($hash->{$section}) {
+ my %tmp = ();
if ($opt{withdefaults}) {
tie %tmp, 'Hash::WithDefaults', $opt{case};
} else {
tie %tmp, $opt{class}
if $opt{class};
}
- $hash->{$section} = \%tmp;
- next;
- }
- }
-
- if (/^([^=]*?)\s*=\s*(.*?)\s*$/) {
- my ($name,$value) = ($1,$2);
+ $hash->{$section} = \%tmp;
+ }
+ next;
+ }
+
+ if (/^([^=]*?)\s*=\s*(.*?)\s*$/) {
+ my ($name,$value) = ($1,$2);
if ($opt{heredoc} eq 'perl' and $value =~ /^<<(['"])?(.+)\1\s*$/) {
my $type = $1;
my $terminator = $2;
@@ -320,15 +317,15 @@
}
}
}
- }
- }
- close $IN;
- return $hash;
+ }
+ }
+ close $IN;
+ return $hash;
}
sub WriteINI {
- my ($file,$hash) = @_;
- open my $OUT, ">$file" or return undef;
+ my ($file,$hash) = @_;
+ open my $OUT, ">$file" or return undef;
if (exists $hash->{'__SECTIONS__'}) {
my $all_have_order = (scalar(@{$hash->{'__SECTIONS__'}}) == scalar(keys %$hash)-1);
foreach my $section (@{$hash->{'__SECTIONS__'}}) {
@@ -384,8 +381,8 @@
print $OUT "\n";
}
}
- close $OUT;
- return 1;
+ close $OUT;
+ return 1;
}
*PrintINI = \&WriteINI;
@@ -413,7 +410,7 @@
sub ReadSection {
- my $text = shift;
+ my $text = shift;
my %opt = @_;
prepareOpt(\%opt);
@@ -429,11 +426,11 @@
my ($lc,$uc) = ( $opt{forName} eq 'lc', $opt{forName} eq 'uc');
my $forValue = $opt{forValue};
- while (<$IN>) {
- /^\s*;/ and next;
-
- if (/^([^=]*?)\s*=\s*(.*?)\s*$/) {
- my ($name,$value) = ($1,$2);
+ while (<$IN>) {
+ /^\s*;/ and next;
+
+ if (/^([^=]*?)\s*=\s*(.*?)\s*$/) {
+ my ($name,$value) = ($1,$2);
if ($opt{heredoc} and $value =~ /^<<(.+)$/) {
my $terminator = $1;
$value = '';
@@ -446,16 +443,16 @@
unless defined $_;
substr ($value, 0, 1) = '';
}
- $value =~ s/%(.*?)%/$opt{systemvars}{$1}/g if $opt{systemvars};
+ $value =~ s/%(.*?)%/$opt{systemvars}{$1}/g if $opt{systemvars};
if ($lc) { $name = lc $name} elsif ($uc) { $name = uc $name };
if ($forValue) {
$value = $forValue->($name, $value, undef, $hash);
}
- $hash->{$name} = $value;
- }
- }
- close $IN;
- return $hash;
+ $hash->{$name} = $value;
+ }
+ }
+ close $IN;
+ return $hash;
}
package Hash::Case::LowerX;
@@ -467,12 +464,12 @@
sub init($)
{ my ($self, $args) = @_;
- $self->SUPER::native_init($args);
-
- croak "No options possible for ".__PACKAGE__
- if keys %$args;
-
- $self;
+ $self->SUPER::native_init($args);
+
+ croak "No options possible for ".__PACKAGE__
+ if keys %$args;
+
+ $self;
}
sub FETCH($) { $_[0]->{($_[1] eq '__SECTIONS__' ? $_[1] : lc $_[1])} }
@@ -512,10 +509,10 @@
The returned hash contains a reference to a hash for each section of
the INI.
- [section]
- name=value
+ [section]
+ name=value
leads to
- $hash->{section}->{name} = value;
+ $hash->{section}->{name} = value;
The available options are:
@@ -534,9 +531,9 @@
0 : heredocs are ignored, $data->{section}{name} will be '<<END'
1 : heredocs are supported, $data->{section}{name} will be "the\nmany lines\nlong value"
- The Perl-lie extensions of name=<<"END" and <<'END' are not supported!
+ The Perl-lie extensions of name=<<"END" and <<'END' are not supported!
'Perl' : heredocs are supported, $data->{section}{name} will be "the\nmany lines\nlong value"
- The Perl-lie extensions of name=<<"END" and <<'END' are supported.
+ The Perl-lie extensions of name=<<"END" and <<'END' are supported.
The <<'END' never interpolates %variables%, the "END" always interpolates variables,
unlike in other values, the %variables% that are not defined do not stay in the string!
@@ -548,9 +545,9 @@
- controls whether the (system) variables enclosed in %% are
interpolated and optionaly contains the values in a hash ref.
- name=%USERNAME%
+ name=%USERNAME%
leads to
- $data->{section}->{name} = "Jenda"
+ $data->{section}->{name} = "Jenda"
systemvars = 1 - yes, take values from %ENV
systemvars = \%hash - yes, take values from %hash
@@ -576,6 +573,12 @@
- allows you to specify the class into which to tie the created hashes. This option overwrites
the "case" and "withdefaults" options!
+You may for example use
+
+ class => 'Tie::IxHash',
+
+to store the sections in hashes that remember the insertion order.
+
=item sectionorder
- if set to a true value then created hash will contain
@@ -644,10 +647,10 @@
Eg.
if (exists $config->{':default'}) {
- foreach my $section (keys %$config) {
- next if $section =~ /^:/;
- AddDefaults( $config, $section, ':default');
- }
+ foreach my $section (keys %$config) {
+ next if $section =~ /^:/;
+ AddDefaults( $config, $section, ':default');
+ }
}
=head3 ReadSection
More information about the Pkg-perl-cvs-commits
mailing list