r6926 - in /branches/upstream/libconfig-inihash-perl: ./ current/ current/Changes current/IniHash.pm current/MANIFEST current/META.yml current/Makefile.PL current/README current/test.pl

azatoth-guest at users.alioth.debian.org azatoth-guest at users.alioth.debian.org
Sat Aug 18 17:17:33 UTC 2007


Author: azatoth-guest
Date: Sat Aug 18 17:17:32 2007
New Revision: 6926

URL: http://svn.debian.org/wsvn/?sc=1&rev=6926
Log:
[svn-inject] Installing original source of libconfig-inihash-perl

Added:
    branches/upstream/libconfig-inihash-perl/
    branches/upstream/libconfig-inihash-perl/current/
    branches/upstream/libconfig-inihash-perl/current/Changes
    branches/upstream/libconfig-inihash-perl/current/IniHash.pm
    branches/upstream/libconfig-inihash-perl/current/MANIFEST
    branches/upstream/libconfig-inihash-perl/current/META.yml
    branches/upstream/libconfig-inihash-perl/current/Makefile.PL
    branches/upstream/libconfig-inihash-perl/current/README
    branches/upstream/libconfig-inihash-perl/current/test.pl

Added: branches/upstream/libconfig-inihash-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libconfig-inihash-perl/current/Changes?rev=6926&op=file
==============================================================================
--- branches/upstream/libconfig-inihash-perl/current/Changes (added)
+++ branches/upstream/libconfig-inihash-perl/current/Changes Sat Aug 18 17:17:32 2007
@@ -1,0 +1,31 @@
+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

Added: branches/upstream/libconfig-inihash-perl/current/IniHash.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libconfig-inihash-perl/current/IniHash.pm?rev=6926&op=file
==============================================================================
--- branches/upstream/libconfig-inihash-perl/current/IniHash.pm (added)
+++ branches/upstream/libconfig-inihash-perl/current/IniHash.pm Sat Aug 18 17:17:32 2007
@@ -1,0 +1,519 @@
+package Config::IniHash;
+
+use Carp;
+use strict;
+use Symbol;
+use IO::Scalar;
+
+use Exporter;
+use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION);
+ at ISA = qw(Exporter);
+ at EXPORT = qw(&ReadINI &WriteINI &PrintINI);
+ at EXPORT_OK = qw(&ReadINI &WriteINI &PrintINI &AddDefaults &ReadSection);
+$VERSION = '2.9.0';
+
+if (0) { # for PerlApp/PerlSvc/PerlCtrl/Perl2Exe
+	require 'Hash/WithDefaults.pm';
+	require 'Hash/Case/Lower.pm';
+	require 'Hash/Case/Upper.pm';
+	require 'Hash/Case/Preserve.pm';
+}
+
+#use vars qw(heredoc systemvars withdefaults forValue);
+$Config::IniHash::case = 'lower';
+	# upper, preserve, toupper, tolower
+$Config::IniHash::heredoc = 0;
+$Config::IniHash::systemvars = 1;
+$Config::IniHash::withdefaults = 0;
+$Config::IniHash::sectionorder = 0;
+$Config::IniHash::allow_multiple = 0;
+$Config::IniHash::comment = qr/^\s*[#;]/;
+sub BREAK () {1}
+
+sub prepareOpt {
+	my $opt = shift();
+
+	$opt->{case} = $Config::IniHash::case unless exists $opt->{case};
+	$opt->{case} = $opt->{insensitive} if exists $opt->{insensitive}; # for backwards compatibility
+	$opt->{heredoc} = $Config::IniHash::heredoc unless exists $opt->{heredoc};
+	$opt->{systemvars} = $Config::IniHash::systemvars unless exists $opt->{systemvars};
+	$opt->{withdefaults} = $Config::IniHash::withdefaults unless exists $opt->{withdefaults};
+	$opt->{forValue} = $Config::IniHash::forValue unless exists $opt->{forValue};
+	$opt->{sectionorder} = $Config::IniHash::sectionorder unless exists $opt->{sectionorder};
+	$opt->{allow_multiple} = $Config::IniHash::allow_multiple unless exists $opt->{allow_multiple};
+	$opt->{comment} = $Config::IniHash::comment unless exists $opt->{comment};
+
+	for ($opt->{case}) {
+		$_ = lc $_;
+		$_ = 'no' unless $_;
+
+		local $Carp::CarpLevel = 1;
+		/^lower/ and do {
+			$opt->{class} = 'Hash::Case::Lower';
+			undef $opt->{forName};
+			BREAK}
+		or
+		/^upper/ and do {
+			$opt->{class} = 'Hash::Case::Upper';
+			undef $opt->{forName};
+			BREAK}
+		or
+		/^preserve/ and do {
+			$opt->{class} = 'Hash::Case::Preserve';
+			undef $opt->{forName};
+			BREAK}
+		or
+		/^toupper/ and do {
+			undef $opt->{class};
+			$opt->{forName} = 'uc';
+			BREAK}
+		or
+		/^tolower/ and do {
+			undef $opt->{class};
+			$opt->{forName} = 'lc';
+			BREAK}
+		or
+		/^(?:no|sensitive)/ and do {
+			undef $opt->{class};
+			undef $opt->{forName};
+			BREAK}
+		or
+			croak "Option 'case' may be set only to:\n\t'lower', 'upper', 'preserve', 'toupper', 'tolower' or 'no'\n";
+
+	}
+
+	if ($opt->{class}) {
+		my $class = $opt->{class};
+		my $file = $class;
+		$file =~ s{::}{/}g;
+		if (!$INC{$file.'.pm'}) {
+			eval "use $class;\n1"
+				or croak "ERROR autoloading $class : $@";
+		}
+	}
+
+	if ($opt->{withdefaults} and !$INC{'Hash/WithDefaults.pm'}) {
+		eval "use Hash::WithDefaults;\n1"
+			or croak "ERROR autoloading Hash::WithDefaults : $@";
+	}
+
+	$opt->{heredoc} = ($opt->{heredoc} ? 1 : 0);
+	if (defined $opt->{systemvars} and $opt->{systemvars}) {
+		$opt->{systemvars} = \%ENV unless (ref $opt->{systemvars});
+	} else {
+		$opt->{systemvars} = 0;
+	}
+
+	if (! ref $opt->{comment}) {
+		$opt->{comment} = qr/^\s*[$opt->{comment}]/;
+	}
+
+	if (ref $opt->{allow_multiple}) {
+		croak "The allow_multiple option must be a true or false scalar or a reference to a HoH or HoA or Ho(comma delimited lists of names)!"
+			unless ref $opt->{allow_multiple} eq 'HASH';
+
+		foreach my $section (values %{$opt->{allow_multiple}}) {
+			if (! ref $section) {
+				$section = {map( ($_ => undef), split( /\s*,\s*/, $section))};
+			} elsif (ref $section eq 'ARRAY') {
+				$section = {map( ($_ => undef), @$section)};
+			} elsif (ref $section ne 'HASH') {
+				croak "The allow_multiple option must be a true or false scalar or a reference to a HoH or HoA or Ho(comma delimited lists of names)!";
+			}
+		}
+	}
+}
+
+sub ReadINI {
+    my $file = shift;
+	my %opt;
+	if (@_ == 1 and ref $_[0]) {
+		%opt = %{$_[0]};
+	} elsif (@_ % 2 == 0) {
+		%opt = @_;
+	} else {
+		croak("ReadINI expects the filename plus either a reference to a hash of options or a list with even number of items!");
+	}
+	prepareOpt(\%opt);
+
+    my $hash;
+	if ($opt{hash}) {
+		$hash = $opt{hash};
+	} else {
+		$hash = {};
+		tie %$hash, $opt{class}
+			if $opt{class};
+	}
+
+    my $section = '';
+	my $IN;
+	if (ref $file) {
+		my $ref = ref $file;
+		if ($ref eq 'SCALAR') {
+			$IN = gensym();
+			tie *$IN, 'IO::Scalar', $file;
+		} elsif ($ref eq 'ARRAY') {
+			my $data = join "\n", map {chomp;$_} @$file;
+			$IN = gensym();
+			tie *$IN, 'IO::Scalar', \$data;
+		} elsif ($ref eq 'HASH') {
+			croak "ReadINI cannot accept a HASH reference as it's parameter!";
+		} else {
+			$IN = $file; #assuming it's a glob or an object that'll know what to do
+		}
+	} else {
+		open $IN, $file or return undef;
+	}
+
+	my ($lc,$uc) = ( (defined $opt{forName} and $opt{forName} eq 'lc'), (defined $opt{forName} and $opt{forName} eq 'uc'));
+	my $forValue = $opt{forValue};
+
+	$hash->{'__SECTIONS__'} = [] if $opt{sectionorder};
+    while (<$IN>) {
+        $_ =~ $opt{comment} and next;
+
+        if (/^\[(.*)\]/) {
+            $section = $1;
+			if ($lc) { $section = lc $section} elsif ($uc) { $section = uc $section };
+			push @{$hash->{'__SECTIONS__'}}, $section if $opt{sectionorder};
+            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);
+			if ($opt{heredoc} and $value =~ /^<<(.+)$/) {
+				my $terminator = $1;
+				$value = '';
+				while (<$IN>) {
+					chomp;
+					last if $_ eq $terminator;
+					$value .= "\n".$_;
+				}
+				croak "Heredoc value for [$section]$name not closed at end of file!"
+				 unless defined $_;
+				substr ($value, 0, 1) = '';
+			}
+            $value =~ s/%([^%]*)%/$opt{systemvars}{$1} || "%$1%"/eg if $opt{systemvars};
+			if ($lc) { $name = lc $name} elsif ($uc) { $name = uc $name };
+			if ($forValue) {
+				$value = $forValue->($name, $value, $section, $hash);
+			}
+			if (defined $value) {
+				if (!$opt{allow_multiple}) {
+					$hash->{$section}{$name} = $value; # overwrite
+				} elsif (!ref $opt{allow_multiple}) {
+					if (exists $hash->{$section}{$name}) {
+						if (ref $hash->{$section}{$name}) {
+							push @{$hash->{$section}{$name}}, $value;
+						} else {
+							$hash->{$section}{$name} = [ $hash->{$section}{$name}, $value]; # second value
+						}
+					} else {
+						$hash->{$section}{$name} = $value; # set
+					}
+				} else {
+					if (exists $opt{allow_multiple}{$section}{$name} or exists $opt{allow_multiple}{'*'}{$name}) {
+						push @{$hash->{$section}{$name}}, $value;
+					} else {
+						$hash->{$section}{$name} = $value; # set
+					}
+				}
+			}
+        }
+    }
+    close $IN;
+    return $hash;
+}
+
+sub WriteINI {
+    my ($file,$hash) = @_;
+    open OUT, ">$file" or return undef;
+	if (exists $hash->{'__SECTIONS__'}) {
+		my $all_have_order = (scalar(@{$hash->{'__SECTIONS__'}}) == scalar(keys %$hash));
+		foreach my $section (@{$hash->{'__SECTIONS__'}}) {
+			print OUT "[$section]\n";
+			my $sec;
+			if (exists $hash->{$section}) {
+				my $sec = $hash->{$section};
+				foreach my $key (keys %{$hash->{$section}}) {
+					if ($key =~ /^[#';]/ and ! defined($sec->{$key})) {
+						print OUT"$key\n";
+					} elsif ($sec->{$key} =~ /\n/) {
+						print OUT"$key=<<*END_$key*\n$sec->{$key}\n*END_$key*\n";
+					} else {
+						print OUT"$key=$sec->{$key}\n";
+					}
+				}
+			} else {
+				$all_have_order = 0;
+			}
+			print OUT "\n";
+		}
+		if (!$all_have_order) {
+			my %ordered; @ordered{@{$hash->{'__SECTIONS__'}}} = ();
+			foreach my $section (keys %$hash) {
+				next if exists($ordered{$section}) or $section eq '__SECTIONS__';
+				print OUT "[$section]\n";
+				my $sec = $hash->{$section};
+				foreach my $key (keys %{$hash->{$section}}) {
+					if ($key =~ /^[#';]/ and ! defined($sec->{$key})) {
+						print OUT"$key\n";
+					} elsif ($sec->{$key} =~ /\n/) {
+						print OUT"$key=<<*END_$key*\n$sec->{$key}\n*END_$key*\n";
+					} else {
+						print OUT"$key=$sec->{$key}\n";
+					}
+				}
+				print OUT "\n";
+			}
+		}
+	} else {
+		foreach my $section (keys %$hash) {
+			print OUT "[$section]\n";
+			my $sec = $hash->{$section};
+			foreach my $key (keys %{$hash->{$section}}) {
+				if ($key =~ /^[#';]/ and ! defined($sec->{$key})) {
+					print OUT"$key\n";
+				} elsif ($sec->{$key} =~ /\n/) {
+					print OUT"$key=<<*END_$key*\n$sec->{$key}\n*END_$key*\n";
+				} else {
+					print OUT"$key=$sec->{$key}\n";
+				}
+			}
+			print OUT "\n";
+		}
+	}
+    close OUT;
+    return 1;
+}
+*PrintINI = \&WriteINI;
+
+sub AddDefaults {
+	my ($ini,$subsection,$mainsection) = @_;
+
+	croak "$subsection doesn't exist in the hash!"
+		unless exists $ini->{$subsection};
+
+	croak "$mainsection doesn't exist in the hash!"
+		unless exists $ini->{$mainsection};
+
+	if ( tied(%{$ini->{$subsection}})->isa('Hash::WithDefaults') ) {
+		tied(%{$ini->{$subsection}})->AddDefault($ini->{$mainsection});
+	} else {
+		croak "You can call AddDefaults ONLY on hashes created with\n\$Win32::IniHash::withdefaults=1 !"
+	}
+}
+
+
+sub ReadSection {
+    my $text = shift;
+	my %opt = @_;
+	prepareOpt(\%opt);
+
+	my $hash= {};
+	if ($opt{withdefaults}) {
+		tie %$hash, 'Hash::WithDefaults', $opt{case};
+	} else {
+		tie %$hash, $opt{class}
+			if $opt{class};
+	}
+	my $IN = gensym();
+	tie *$IN, 'IO::Scalar', \$text;
+
+	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);
+			if ($opt{heredoc} and $value =~ /^<<(.+)$/) {
+				my $terminator = $1;
+				$value = '';
+				while (<$IN>) {
+					chomp;
+					last if $_ eq $terminator;
+					$value .= "\n".$_;
+				}
+				croak "Heredoc value for $name not closed at end of string!"
+					unless defined $_;
+				substr ($value, 0, 1) = '';
+			}
+            $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;
+}
+
+1;
+__END__
+
+=head1 NAME
+
+Config::IniHash - Perl extension for reading and writing INI files
+
+version 2.9.0
+
+=head1 SYNOPSIS
+
+  use Config::IniHash;
+  $Config = ReadINI 'c:\some\file.ini';
+
+=head1 DESCRIPTION
+
+This module reads and writes INI files.
+
+=head2 Functions
+
+=head3 ReadINI
+
+	$hashreference = ReadINI ($filename, %options)
+	$hashreference = ReadINI (\$data, %options)
+	$hashreference = ReadINI (\@data, %options)
+	$hashreference = ReadINI ($filehandle, %options)
+
+The returned hash contains a reference to a hash for each section of
+the INI.
+
+    [section]
+    name=value
+  leads to
+    $hash->{section}->{name}  = value;
+
+The available options are:
+
+=over 4
+
+=item heredoc
+
+- controls whether the module supports the heredoc syntax :
+
+	name=<<END
+	the
+	many lines
+	long value
+	END
+	othername=value
+
+Default: 0 = OFF
+
+=item systemvars
+
+- controls whether the (system) variables enclosed in %% are
+interpolated and optionaly contains the values in a hash ref.
+
+    name=%USERNAME%
+  leads to
+    $data->{section}->{name} = "Jenda"
+
+	systemvars = 1	- yes, take values from %ENV
+	systemvars = \%hash	- yes, take values from %hash
+	systemvars = 0	- no
+
+=item case
+
+- controls whether the created hash is case insensitive. The possible values are
+
+  sensitive	- the hash will be case sensitive
+  tolower	- the hash will be case sensitive, all keys are made lowercase
+  toupper	- the hash will be case sensitive, all keys are made uppercase
+  preserve	- the hash will be case insensitive, the case is preserved
+  lower	- the hash will be case insensitive, all keys are made lowercase
+  upper	- the hash will be case insensitive, all keys are made uppercase
+
+=item withdefaults
+
+- controls whether the created section hashes support defaults.
+
+=item sectionorder
+
+- if set to a true value then created hash will contain
+
+	$config->{'__SECTIONS__'} = [ 'the', 'names', 'of', 'the', 'sections', 'in', 'the',
+		'order', 'they', 'were', 'specified', 'in', 'the', 'INI file'];
+
+=item allow_multiple
+
+- if set to a true scalar value then multiple items with the same names in a section
+do not overwrite each other, but result in an array of the values.
+
+- if set to a hash of hashes (or hash of arrays or hash of comma separated item names)
+specifies what items in what sections will end up as
+hashes containing the list of values. All the specified items will be arrays, even if
+there is just a single value. To affect the items in all sections use section name '*'.
+
+By default false.
+
+=item forValue
+
+- allows you to install a callback that will be called for each value as soon as it is read
+but before it is stored in the hash.
+The function is called like this:
+
+  $value = $forValue->($name, $value, $sectionname, $INIhashref);
+
+If the callback returns an undef, the value will not be stored.
+
+=item comment
+
+- regular expression used to identify comments or a string containing the list of characters starting a comment.
+Each line is tested against the regexp is ignored if matches. If you specify a string a regexp like this will be created:
+
+	qr/^\s*[the_list]/
+
+The default is
+
+	qr/^\s*[#;]
+
+=back
+
+You may also set the defaults for the options by modifying the $Config::IniHash::optionname
+variables. These default settings will be used if you do not specify the option in the ReadINI()
+or ReadSection() call.
+
+=head3 ReadSection
+
+  $hashreference = ReadSection ($string)
+
+This function parses a string as if it was a section of an INI file and creates a hash with the values.
+It accepts the same options as ReadINI.
+
+=head3 WriteINI
+
+  WriteINI ($filename, $hashreference)
+
+Writes the hash of hashes to a file.
+
+=head3 PrintINI
+
+The same as WriteINI().
+
+=head1 AUTHOR
+
+Jan Krynicky <Jenda at Krynicky.cz>
+http://Jenda.Krynicky.cz
+
+=head1 COPYRIGHT
+
+Copyright (c) 2002-2005 Jan Krynicky <Jenda at Krynicky.cz>. All rights reserved.
+
+This program is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=cut

Added: branches/upstream/libconfig-inihash-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/libconfig-inihash-perl/current/MANIFEST?rev=6926&op=file
==============================================================================
--- branches/upstream/libconfig-inihash-perl/current/MANIFEST (added)
+++ branches/upstream/libconfig-inihash-perl/current/MANIFEST Sat Aug 18 17:17:32 2007
@@ -1,0 +1,7 @@
+Changes
+IniHash.pm
+Makefile.PL
+MANIFEST
+README
+test.pl
+META.yml                                 Module meta-data (added by MakeMaker)

Added: branches/upstream/libconfig-inihash-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libconfig-inihash-perl/current/META.yml?rev=6926&op=file
==============================================================================
--- branches/upstream/libconfig-inihash-perl/current/META.yml (added)
+++ branches/upstream/libconfig-inihash-perl/current/META.yml Sat Aug 18 17:17:32 2007
@@ -1,0 +1,13 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
+name:         Config-IniHash
+version:      2.9.0
+version_from: IniHash.pm
+installdirs:  site
+requires:
+    Hash::Case:                    0
+    Hash::WithDefaults:            0.04
+    IO::Scalar:                    0
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.17

Added: branches/upstream/libconfig-inihash-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libconfig-inihash-perl/current/Makefile.PL?rev=6926&op=file
==============================================================================
--- branches/upstream/libconfig-inihash-perl/current/Makefile.PL (added)
+++ branches/upstream/libconfig-inihash-perl/current/Makefile.PL Sat Aug 18 17:17:32 2007
@@ -1,0 +1,15 @@
+use ExtUtils::MakeMaker;
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+WriteMakefile(
+    'NAME'		=> 'Config::IniHash',
+    'VERSION_FROM'	=> 'IniHash.pm', # finds $VERSION
+    ($] >= 5.005 ?    ## Add these new keywords supported since 5.005
+      (ABSTRACT_FROM => 'IniHash.pm', # retrieve abstract from module
+       AUTHOR     => 'Jenda Krynicky (Jenda at Krynicky.cz)') : ()),
+	PREREQ_PM   => {
+	'Hash::Case'	=> '0', # or a minimum workable version
+	'Hash::WithDefaults' => '0.04',
+	'IO::Scalar' => 0,
+    },
+);

Added: branches/upstream/libconfig-inihash-perl/current/README
URL: http://svn.debian.org/wsvn/branches/upstream/libconfig-inihash-perl/current/README?rev=6926&op=file
==============================================================================
--- branches/upstream/libconfig-inihash-perl/current/README (added)
+++ branches/upstream/libconfig-inihash-perl/current/README Sat Aug 18 17:17:32 2007
@@ -1,0 +1,28 @@
+Config/IniHash version 2.8.1
+===========================
+
+This module reads and writes INI files.
+
+INSTALLATION
+
+To install this module type the following:
+
+   perl Makefile.PL
+   make
+   make test
+   make install
+
+DEPENDENCIES
+
+This module requires these other modules and libraries:
+
+  Hash::Case
+  Hash::WithDefaults
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2002-2007 Jenda Krynicky <Jenda at Krynicky.cz>
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+

Added: branches/upstream/libconfig-inihash-perl/current/test.pl
URL: http://svn.debian.org/wsvn/branches/upstream/libconfig-inihash-perl/current/test.pl?rev=6926&op=file
==============================================================================
--- branches/upstream/libconfig-inihash-perl/current/test.pl (added)
+++ branches/upstream/libconfig-inihash-perl/current/test.pl Sat Aug 18 17:17:32 2007
@@ -1,0 +1,29 @@
+# Before `make install' is performed this script should be runnable with
+# `make test'. After `make install' it should work as `perl test.pl'
+
+#########################
+
+use Test::More tests => 4;
+#use diagnostics;
+
+BEGIN { use_ok( 'Config::IniHash' ); }
+
+my %orig_data = (
+	sec1 => {
+		foo => 5,
+		bar => 'Hello World!'
+	},
+	seC2 => {
+		what => 'sgfdfg=wtert',
+		other => 'fsdgfg;dfhfdghfg',
+	},
+);
+
+my $filename = "$ENV{TEMP}\\test_Config_IniHash_$$.INI";
+ok( WriteINI( $filename, \%orig_data), "WriteINI => $filename");
+END { unlink $filename }
+
+my $read_data = ReadINI( $filename, {case => 'sensitive'});
+ok( (defined($read_data) and ref($read_data)), "ReadINI <= $filename");
+
+is_deeply( \%orig_data, $read_data, "Read data match the original");




More information about the Pkg-perl-cvs-commits mailing list