@@ -1,37 +1,48 @@
Revision history for Perl module Tie::File::AsHash
-0.01 Mon Jan 3 11:42:11 2005
- - Original version, never released
-
-0.02 Tue Jan 4 10:05:43 2005
- - Code cleaned up, numerous modifications
- - Made some basic tests
- - Initial release on CPAN
-
-0.03 Tue Jan 4 16:26:16 2005
- - No more global (lexical to file) variables - uses
- $self for parameters
- - Renamed parameters (split and join)
- - Used \Q and \E in regexes where needed
- - Regexes use the s modifier now, to allow for
- newlines in strings
- - Other minor changes to documentation and code
- - Module is still beta
-
-0.04 Wed Feb 2 15:33:40 2005
- - NEXTKEY wasn't incrementing the index
-
-0.05 Wed Feb 2 16:40:20 2005
- - Rather major typo in the module's POD
- - More tests
-
-0.06 Wed Feb 2 22:10:23 2005
- - Added META.yml to package
- - More tests
-
-0.07 Thu Oct 27 09:58:32 2005
- - Fixed small problem in sub STORE. Thanks
- Marco Poleggi for the patch!
-
-0.08 Mon Nov 21 19:41:00 2005
- - Broken test cases fixed. Test failed on older versions of Perl (< 5.8.3) and Windows
+0.200 2013-11-12
+ - version bump for synchronize with Tie::Array::AsHash
+ - reformat Changes as per CPAN::Changes::Spec
+ - move repository to GitHub
+ - modernize toolchain
+ - add author tests to the repository (not distribution!)
+
+0.09 2008-05-14
+ - Functionality to work on array splitted to Tie::Array::AsHash
+ - Derive from Tie::Array::AsHash
+
+0.08 2005-11-21
+ - Broken test cases fixed. Test failed on older versions of Perl (< 5.8.3) and Windows
+
+0.07 2005-10-27
+ - Fixed small problem in sub STORE. Thanks
+ Marco Poleggi for the patch!
+
+0.06 2005-02-02
+ - Added META.yml to package
+ - More tests
+
+0.05 2005-02-02
+ - Rather major typo in the module's POD
+ - More tests
+
+0.04 2005-02-02
+ - NEXTKEY wasn't incrementing the index
+
+0.03 2005-01-04
+ - No more global (lexical to file) variables - uses
+ $self for parameters
+ - Renamed parameters (split and join)
+ - Used \Q and \E in regexes where needed
+ - Regexes use the s modifier now, to allow for
+ newlines in strings
+ - Other minor changes to documentation and code
+ - Module is still beta
+
+0.02 2005-01-04
+ - Code cleaned up, numerous modifications
+ - Made some basic tests
+ - Initial release on CPAN
+
+0.01 2001-01-03
+ - Original version, never released
@@ -1,16 +1,18 @@
-Changes Changes in the module throught time
-lib/Tie/File/AsHash.pm The module
-Makefile.PL Makefile
-MANIFEST This list of files
-README README document containing module information
-t/00_version.t make sure test version is for this module
-t/01_fetch.t get data from hash
-t/02_store.t put data in hash
-t/03_delete.t delete()
-t/04_exists.t exists()
-t/05_scalar.t tests how hash behaves in scalar context
-t/06_keys.t keys()
-t/07_values.t values()
-t/08_each.t each()
-t/testfile used in the testing process
-META.yml Module meta-data
+Changes
+lib/Tie/File/AsHash.pm
+Makefile.PL
+MANIFEST This list of files
+MANIFEST.SKIP
+README
+t/00-load.t
+t/01-fetch.t
+t/02-store.t
+t/03-delete.t
+t/04-exists.t
+t/05-scalar.t
+t/06-keys.t
+t/07-values.t
+t/08-each.t
+t/testfile
+META.yml Module YAML meta-data (added by MakeMaker)
+META.json Module JSON meta-data (added by MakeMaker)
@@ -0,0 +1,32 @@
+\B\.svn\b
+\B\.git\b
+\.gitignore$
+\.[Bb][Aa][Kk]$
+\.orig$
+\.old$
+\.tdy$
+\.tmp$
+\..*swp
+^Makefile$
+^Build$
+^Build\.bat$
+\.Inline/.*
+_Inline/.*
+\.bak$
+\.tar$
+\.tgz$
+\.tar\.gz$
+^mess/
+^tmp/
+^testdata/
+^blib/
+^sandbox/
+^pm_to_blib$
+^_build/.*
+~$
+.*\.planner
+^\..*
+Tie-File-AsHash-.*
+\bxt
+^MYMETA\.json$
+^MYMETA\..*$
@@ -0,0 +1,61 @@
+{
+ "abstract" : "access lines of a file as a hash splitting at separator",
+ "author" : [
+ "Chris Angell <chris@chrisangell.com>",
+ "Jens Rehsack <rehsack@cpan.org>"
+ ],
+ "dynamic_config" : 1,
+ "generated_by" : "ExtUtils::MakeMaker version 6.82, CPAN::Meta::Converter version 2.132830",
+ "license" : [
+ "perl_5"
+ ],
+ "meta-spec" : {
+ "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+ "version" : "2"
+ },
+ "name" : "Tie-File-AsHash",
+ "no_index" : {
+ "directory" : [
+ "t",
+ "inc"
+ ]
+ },
+ "prereqs" : {
+ "build" : {
+ "requires" : {}
+ },
+ "configure" : {
+ "requires" : {
+ "ExtUtils::MakeMaker" : "0"
+ }
+ },
+ "develop" : {
+ "requires" : {
+ "Test::CPAN::Changes" : "0",
+ "Test::CheckManifest" : "0",
+ "Test::Pod" : "0",
+ "Test::Pod::Coverage" : "0",
+ "Test::Pod::Spelling::CommonMistakes" : "0"
+ }
+ },
+ "runtime" : {
+ "requires" : {
+ "Tie::Array::AsHash" : "0.200",
+ "Tie::File" : "0",
+ "perl" : "v5.8.1"
+ }
+ },
+ "test" : {
+ "requires" : {
+ "Test::More" : "0.9"
+ }
+ }
+ },
+ "release_status" : "stable",
+ "resources" : {
+ "license" : [
+ "http://dev.perl.org/licenses/"
+ ]
+ },
+ "version" : "0.200"
+}
@@ -1,11 +1,27 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
-name: Tie-File-AsHash
-version: 0.08
-version_from: lib/Tie/File/AsHash.pm
-installdirs: site
+---
+abstract: 'access lines of a file as a hash splitting at separator'
+author:
+ - 'Chris Angell <chris@chrisangell.com>'
+ - 'Jens Rehsack <rehsack@cpan.org>'
+build_requires:
+ Test::More: 0.9
+configure_requires:
+ ExtUtils::MakeMaker: 0
+dynamic_config: 1
+generated_by: 'ExtUtils::MakeMaker version 6.82, CPAN::Meta::Converter version 2.132830'
+license: perl
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
+name: Tie-File-AsHash
+no_index:
+ directory:
+ - t
+ - inc
requires:
- Tie::File:
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.17
+ Tie::Array::AsHash: 0.200
+ Tie::File: 0
+ perl: v5.8.1
+resources:
+ license: http://dev.perl.org/licenses/
+version: 0.200
@@ -1,10 +1,112 @@
+use strict;
+use warnings;
+
+use 5.008001;
+
use ExtUtils::MakeMaker;
-WriteMakefile(
- NAME => 'Tie::File::AsHash',
- VERSION_FROM => 'lib/Tie/File/AsHash.pm',
- PREREQ_PM => { "Tie::File" => undef },
- ($] >= 5.005 ? ## Add these new keywords supported since 5.005
- (ABSTRACT_FROM => 'lib/Tie/File/AsHash.pm',
- AUTHOR => 'Chris Angell <chris@chrisangell.com>') : ()),
+my %RUN_DEPS = (
+ "Tie::File" => undef,
+ "Tie::Array::AsHash" => "0.200",
+ );
+my %CONFIGURE_DEPS = (
+ 'ExtUtils::MakeMaker' => 0,
+ );
+my %BUILD_DEPS = ();
+
+my %TEST_DEPS = (
+ 'Test::More' => 0.90,
+ );
+
+WriteMakefile1(
+ MIN_PERL_VERSION => '5.008001',
+ META_ADD => {
+ 'meta-spec' => { version => 2 },
+ resources => {
+ repository => 'https://github.com/rehsack/Tie-File-AsHash',
+ license => 'http://dev.perl.org/licenses/',
+ },
+ prereqs => {
+ develop => {
+ requires => {
+ 'Test::CPAN::Changes' => 0,
+ 'Test::CheckManifest' => 0,
+ 'Test::Pod' => 0,
+ 'Test::Pod::Coverage' => 0,
+ 'Test::Pod::Spelling::CommonMistakes' => 0,
+ },
+ },
+ configure => {
+ requires => {%CONFIGURE_DEPS},
+ },
+ build => { requires => {%BUILD_DEPS} },
+ test => { requires => {%TEST_DEPS} },
+ runtime => {
+ requires => {
+ %RUN_DEPS,
+ perl => '5.8.1',
+ },
+ },
+ },
+ },
+ NAME => 'Tie::File::AsHash',
+ VERSION_FROM => 'lib/Tie/File/AsHash.pm',
+ ABSTRACT_FROM => 'lib/Tie/File/AsHash.pm',
+ LICENSE => 'perl',
+ AUTHOR => [ q{Chris Angell <chris@chrisangell.com>}, q{Jens Rehsack <rehsack@cpan.org>} ],
+ PREREQ_PM => \%RUN_DEPS,
+ BUILD_REQUIRES => \%BUILD_DEPS,
+ TEST_REQUIRES => \%TEST_DEPS,
+ test => { TESTS => 't/*.t xt/*.t' },
);
+
+sub WriteMakefile1
+{ # originally written by Alexandr Ciornii, version 0.21. Added by eumm-upgrade.
+ my %params = @_;
+ my $eumm_version = $ExtUtils::MakeMaker::VERSION;
+ $eumm_version = eval $eumm_version;
+ die "EXTRA_META is deprecated" if ( exists( $params{EXTRA_META} ) );
+ die "License not specified" if ( !exists( $params{LICENSE} ) );
+ if ( $params{TEST_REQUIRES} and ( $eumm_version < 6.6303 ) )
+ {
+ if ( $params{BUILD_REQUIRES} )
+ {
+ $params{BUILD_REQUIRES} = { %{ $params{BUILD_REQUIRES} }, %{ $params{TEST_REQUIRES} } };
+ }
+ else
+ {
+ $params{BUILD_REQUIRES} = delete $params{TEST_REQUIRES};
+ }
+ }
+ if ( $params{BUILD_REQUIRES} and ( $eumm_version < 6.5503 ) )
+ {
+ #EUMM 6.5502 has problems with BUILD_REQUIRES
+ $params{PREREQ_PM} = { %{ $params{PREREQ_PM} || {} }, %{ $params{BUILD_REQUIRES} } };
+ delete $params{BUILD_REQUIRES};
+ }
+ delete $params{CONFIGURE_REQUIRES} if ( $eumm_version < 6.52 );
+ delete $params{MIN_PERL_VERSION} if ( $eumm_version < 6.48 );
+ delete $params{META_MERGE} if ( $eumm_version < 6.46 );
+ delete $params{META_ADD}{prereqs} if ( $eumm_version < 6.58 );
+ delete $params{META_ADD}{'meta-spec'} if ( $eumm_version < 6.58 );
+ delete $params{META_ADD} if ( $eumm_version < 6.46 );
+ delete $params{LICENSE} if ( $eumm_version < 6.31 );
+ delete $params{AUTHOR} if ( $] < 5.005 );
+ delete $params{ABSTRACT_FROM} if ( $] < 5.005 );
+ delete $params{BINARY_LOCATION} if ( $] < 5.005 );
+
+ # more or less taken from Moose' Makefile.PL
+ if ( $params{CONFLICTS} )
+ {
+ my $ok = CheckConflicts(%params);
+ exit(0) if ( $params{PREREQ_FATAL} and not $ok );
+ my $cpan_smoker = grep { $_ =~ m/(?:CR_SMOKER|CPAN_REPORTER|AUTOMATED_TESTING)/ } keys %ENV;
+ unless ( $cpan_smoker || $ENV{PERL_MM_USE_DEFAULT} || $ENV{SQL_STATEMENT_WARN_UPDATE} )
+ {
+ sleep 4 unless ($ok);
+ }
+ delete $params{CONFLICTS};
+ }
+
+ WriteMakefile(%params);
+}
@@ -1,4 +1,4 @@
-Tie-File-AsHash version 0.08
+Tie-File-AsHash version 0.09
============================
Tie::File::AsHash - Like Tie::File but access lines using a hash instead of an
@@ -20,14 +20,16 @@ DEPENDENCIES
This module requires these other modules and libraries:
Tie::File
+ Tie::Array::AsHash
AUTHOR
-Chris Angell <chris@chrisangell.com>
+Chris Angell <chris@chrisangell.com>, Jens Rehsack <rehsack@web.de>
COPYRIGHT AND LICENCE
Copyright (C) 2005 by Chris Angell
+Copyright (C) 2008 by Jens Rehsack
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, including any version of Perl 5.
@@ -1,179 +1,64 @@
package Tie::File::AsHash;
use strict;
+
# use warnings;
use vars qw($VERSION);
use Carp;
use Tie::File;
+use base qw(Tie::Array::AsHash);
-$VERSION = "0.08";
-
-sub TIEHASH {
-
- croak usage() if @_ % 2;
-
- my ($obj, $filename, %opts) = @_;
-
- # set delimiter and croak if none was supplied
- my $split = delete $opts{split} or croak usage();
-
- # set join, an optional argument
- my $join = delete $opts{join};
-
- # if split's value is a regex and join isn't specified, croak
- croak "Tie::File::AsHash error: no 'join' option specified and 'split' option is a regular expression\n", usage()
- if ref($split) eq "Regexp" and not defined $join;
-
- # the rest of the options can feed right into Tie::File
- # Tie::File can worry about checking the arguments for validity, etc.
- tie my @file, 'Tie::File', $filename, %opts or return;
-
- return bless { split => $split, join => $join, file => \@file }, $obj;
-
-}
-
-sub FETCH {
-
- my ($self, $key) = @_;
-
- # find the key and get corresponding value
- for (@{$self->{file}}) {
-
- return $1 if /^\Q$key\E$self->{split}(.*)/s;
-
- }
-
-}
-
-sub STORE {
-
- my ($self, $key, $val) = @_;
-
- # look for $key in the file and replace value if $key is found
- for (@{$self->{file}}) {
-
- # found the key? good. replace the entire line with the correct key, delim, and value
- if (/^\Q$key\E$self->{split}/s) {
-
- # Marco Poleggi <marco.poleggi@cern.ch> supplied a patch that changed exists
- # to defined in the next line of code. Thanks Macro!
- $_ = $key . (defined $self->{join} ? $self->{join} : $self->{split}) . $val;
- return;
-
- }
-
- }
-
- # if key doesn't exist in the file, append to end of file
- push @{$self->{file}}, $key . (defined $self->{join} ? $self->{join} : $self->{split}) . $val;
-
-}
-
-sub DELETE {
-
- my ($self, $key) = @_;
-
- # first, look for the key in the file
- # next, delete the line in the file
- # finally, return the value, which might not contain anything
- # perl's builtin delete() returns the deleted value, so emulate the behavior
-
- for my $i (0 .. $#{ $self->{file} } ) {
+$VERSION = "0.200";
- if ($self->{file}->[$i] =~ /^\Q$key\E$self->{split}(.*)/s) {
+my $usage = "usage: tie %hash, 'Tie::File::AsHash', 'filename', "
+ . "split => ':' [, join => '#', 'Tie::File option' => value, ... ]\n";
- splice @{$self->{file}}, $i, 1; # remove entry from file
- return $1;
+sub TIEHASH
+{
+ croak( $usage ) if ( scalar(@_) % 2 );
- }
+ my ( $obj, $filename, %opts ) = @_;
- }
+ # set delimiter and croak if none was supplied
+ my $split = delete( $opts{split} ) or croak( $usage );
-}
-
-sub CLEAR { @{ $_[0]->{file} } = () }
-
-sub EXISTS {
-
- my ($self, $key) = @_;
-
- for (@{$self->{file}}) {
-
- return 1 if /^\Q$key\E$self->{split}/s;
-
- }
-
-}
-
-sub FIRSTKEY {
-
- my ($self) = @_;
-
- # deal with empty files
- return unless exists $self->{file}->[0];
-
- my ($val) = $self->{file}->[0] =~ /^(.*?)$self->{split}/s;
-
- # reset index for NEXTKEY
- $self->{index} = 0;
-
- return $val;
-
-}
-
-sub NEXTKEY {
+ # set join, an optional argument
+ my $join = delete( $opts{join} );
- my ($self) = @_;
-
- # keep track of what line of the file we are on
- $self->{index}++;
-
- # deal with one-line files
- if ($self->{index} == 1) {
+ # if split's value is a regex and join isn't specified, croak
+ croak( "Tie::File::AsHash error: no 'join' option specified and 'split' option is a regular expression\n", $usage )
+ if ( ref($split) eq 'Regexp' and not defined($join) );
- return unless exists $self->{file}->[1];
+ # the rest of the options can feed right into Tie::File
+ # Tie::File can worry about checking the arguments for validity, etc.
+ my $tiefile = tie my @file, 'Tie::File', $filename, %opts or return;
- }
+ $obj = $obj->SUPER::TIEHASH(
+ array => \@file,
+ split => $split,
+ join => $join,
+ );
- # and the end of the file
- return if $self->{index} >= @{$self->{file}};
-
- my ($val) = $self->{file}->[ $self->{index} ] =~ /^(.*?)$self->{split}/s;
-
- return $val;
-
-}
-
-sub SCALAR {
-
- my ($self) = @_;
-
- # can't think of any other good use for scalar %hash besides this
- return scalar @{$self->{file}};
+ $obj->{file} = $tiefile;
+ return $obj;
}
-sub UNTIE {
+sub UNTIE
+{
+ my ($self) = @_;
- my ($self) = @_;
-
- untie @{$self->{file}};
+ $self->{file} = undef;
+ untie @{ $self->{array} };
+ $self->SUPER::UNTIE();
}
sub DESTROY { UNTIE(@_) }
-sub usage {
-
- return "usage: tie %hash, 'Tie::File::AsHash', 'filename', split => ':' [, join => '#', 'Tie::File option' => value, ... ]\n";
-
-}
-
-
=head1 NAME
-Tie::File::AsHash - Like Tie::File but access lines using a hash instead of an
-array
+Tie::File::AsHash - access lines of a file as a hash splitting at separator
=head1 SYNOPSIS
@@ -203,11 +88,12 @@ file:
=head1 DESCRIPTION
-C<Tie::File::AsHash> uses C<Tie::File> and perl code so files can be tied to
-hashes. C<Tie::File> does all the hard work while C<Tie::File::AsHash> works
-a little magic of its own.
+C<Tie::File::AsHash> uses C<Tie::File> and perl code from C<Tie::Array::AsHash>
+so files can be tied to hashes. C<Tie::File> does all the hard work while
+C<Tie::File::AsHash> works a little magic of its own.
-The module was initially written for managing htpasswd-format password files.
+The module was initially written by Chris Angell <chris@chrisangell.com> for
+managing htpasswd-format password files.
=head1 USAGE
@@ -239,7 +125,7 @@ to the file. Otherwise, the module dies with an error message.
tie %hash, 'Tie::File::AsHash', 'filename', split => qr(\s+), join => " "
or die "Problem tying %hash: $!";
-Obviously no one wants lines like "key(?-xism:\s+)val" in their files.
+Obviously no one wants lines like "key(?-xism:\s+)val" in their files.
All other options are passed directly to C<Tie::File>, so read its
documentation for more information.
@@ -278,13 +164,13 @@ C<changepass.pl> changes password file entries when the lines are of
die "Usage: $0 user password" unless @ARGV == 2;
my ($user, $newpass) = @ARGV;
-
+
tie my %users, 'Tie::File::AsHash', '/pwdb/users.txt', split => ':'
or die "Problem tying %hash: $!";
# username isn't in the password file? see if the admin wants it added
unless (exists $users{$user}) {
-
+
print "User '$user' not found in db. Add as a new user? (y/n)\n";
chomp(my $y_or_n = <STDIN>);
set_pw($user, $newpass) if $y_or_n =~ /^[yY]/;
@@ -295,11 +181,11 @@ C<changepass.pl> changes password file entries when the lines are of
print "Done.\n";
}
-
+
sub set_pw { $users{$_[0]} = crypt($_[1], "AA") }
=head2 Using the join option
-
+
Here's code that would allow the delimiter to be ':' or '#' but prefers '#':
tie my %hash, 'Tie::File::AsHash', 'filename', split => qr/[:#]/, join => "#" or die $!;
@@ -314,7 +200,7 @@ Say you want to be sure no ':' delimiters exist in the file:
=head1 AUTHOR
-Chris Angell <chris@chrisangell.com>
+Chris Angell <chris@chrisangell.com>, Jens Rehsack <rehsack@web.de>
Feel free to email me with suggestions, fixes, etc.
@@ -322,14 +208,14 @@ Thanks to Mark Jason Dominus for authoring the superb Tie::File module.
=head1 COPYRIGHT
-Copyright (C) 2004, Chris Angell. All Rights Reserved.
+Copyright (C) 2004, Chris Angell, 2008-2013, Jens Rehsack. All Rights Reserved.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, including any version of Perl 5.
=head1 SEE ALSO
-perl(1), perltie(1), Tie::File(1)
+perl(1), perltie(1), Tie::File(3pm), Tie::Array::AsHash(3pm)
=cut
@@ -0,0 +1,9 @@
+#!perl -T
+
+use Test::More tests => 1;
+
+BEGIN {
+ use_ok( 'Tie::File::AsHash' ) || BAIL_OUT "Couldn't load Tie::File::AsHash";
+}
+
+diag( "Testing Tie::File::AsHash $Tie::File::AsHash::VERSION, Perl $], $^X" );
@@ -1,7 +0,0 @@
-use Test::More tests => 2;
-
-BEGIN { use_ok('Tie::File::AsHash') };
-
-my $testversion = "0.08";
-
-ok($Tie::File::AsHash::VERSION == $testversion, "Test version check -- test version must match module version");
@@ -0,0 +1,12 @@
+use Test::More tests => 4;
+
+BEGIN { use_ok('Tie::File::AsHash') };
+
+# make sure the test file exists
+ok(-e "t/testfile", "testfile that is used by the various tests");
+
+my %hash;
+
+ok((tie %hash, "Tie::File::AsHash", "t/testfile", split => ":", recsep => "\n"), "tie");
+
+ok($hash{foo} eq "bar", "fetch");
@@ -1,12 +0,0 @@
-use Test::More tests => 4;
-
-BEGIN { use_ok('Tie::File::AsHash') };
-
-# make sure the test file exists
-ok(-e "t/testfile", "testfile that is used by the various tests");
-
-my %hash;
-
-ok((tie %hash, "Tie::File::AsHash", "t/testfile", split => ":", recsep => "\n"), "tie");
-
-ok($hash{foo} eq "bar", "fetch");
@@ -0,0 +1,11 @@
+use Test::More tests => 3;
+
+BEGIN { use_ok('Tie::File::AsHash') };
+
+my %hash;
+
+ok((tie %hash, "Tie::File::AsHash", "t/testfile", split => ":", recsep => "\n"), "tie");
+
+$hash{newkey} = "newval";
+
+ok($hash{newkey} eq "newval", "store");
@@ -1,11 +0,0 @@
-use Test::More tests => 3;
-
-BEGIN { use_ok('Tie::File::AsHash') };
-
-my %hash;
-
-ok((tie %hash, "Tie::File::AsHash", "t/testfile", split => ":", recsep => "\n"), "tie");
-
-$hash{newkey} = "newval";
-
-ok($hash{newkey} eq "newval", "store");
@@ -0,0 +1,9 @@
+use Test::More tests => 3;
+
+BEGIN { use_ok('Tie::File::AsHash') };
+
+my %hash;
+
+ok((tie %hash, "Tie::File::AsHash", "t/testfile", split => ":", recsep => "\n"), "tie");
+
+ok(delete $hash{newkey}, "delete");
@@ -1,9 +0,0 @@
-use Test::More tests => 3;
-
-BEGIN { use_ok('Tie::File::AsHash') };
-
-my %hash;
-
-ok((tie %hash, "Tie::File::AsHash", "t/testfile", split => ":", recsep => "\n"), "tie");
-
-ok(delete $hash{newkey}, "delete");
@@ -0,0 +1,9 @@
+use Test::More tests => 3;
+
+BEGIN { use_ok('Tie::File::AsHash') };
+
+my %hash;
+
+ok((tie %hash, "Tie::File::AsHash", "t/testfile", split => ":", recsep => "\n"), "tie");
+
+ok(exists $hash{foo}, "exists");
@@ -1,9 +0,0 @@
-use Test::More tests => 3;
-
-BEGIN { use_ok('Tie::File::AsHash') };
-
-my %hash;
-
-ok((tie %hash, "Tie::File::AsHash", "t/testfile", split => ":", recsep => "\n"), "tie");
-
-ok(exists $hash{foo}, "exists");
@@ -0,0 +1,14 @@
+use Test::More tests => ($] >= 5.008003 ? 4 : 3);
+
+BEGIN { use_ok('Tie::File::AsHash') };
+
+my %hash;
+
+ok((my $obj = tie %hash, "Tie::File::AsHash", "t/testfile", split => ":", recsep => "\n"), "tie");
+
+# 6 lines in the file
+ok($obj->SCALAR() == 6, "scalar");
+
+if ($] >= 5.008003) {
+ ok(scalar %hash == 6, "scalar");
+}
@@ -1,14 +0,0 @@
-use Test::More tests => ($] >= 5.008003 ? 4 : 3);
-
-BEGIN { use_ok('Tie::File::AsHash') };
-
-my %hash;
-
-ok((my $obj = tie %hash, "Tie::File::AsHash", "t/testfile", split => ":", recsep => "\n"), "tie");
-
-# 6 lines in the file
-ok($obj->SCALAR() == 6, "scalar");
-
-if ($] >= 5.008003) {
- ok(scalar %hash == 6, "scalar");
-}
@@ -0,0 +1,14 @@
+use Test::More tests => 3;
+
+BEGIN { use_ok('Tie::File::AsHash') };
+
+my %hash;
+
+my @keys = qw/first foo one two bar last/;
+
+ok((tie %hash, "Tie::File::AsHash", "t/testfile", split => ":", recsep => "\n"), "tie");
+
+my @keys_from_testfile = keys %hash;
+
+# yes, keys are in order, though that may change
+ok("@keys" eq "@keys_from_testfile");
@@ -1,14 +0,0 @@
-use Test::More tests => 3;
-
-BEGIN { use_ok('Tie::File::AsHash') };
-
-my %hash;
-
-my @keys = qw/first foo one two bar last/;
-
-ok((tie %hash, "Tie::File::AsHash", "t/testfile", split => ":", recsep => "\n"), "tie");
-
-my @keys_from_testfile = keys %hash;
-
-# yes, keys are in order, though that may change
-ok("@keys" eq "@keys_from_testfile");
@@ -0,0 +1,14 @@
+use Test::More tests => 3;
+
+BEGIN { use_ok('Tie::File::AsHash') };
+
+my %hash;
+
+my @vals = qw/line bar uno dos baz line/;
+
+ok((tie %hash, "Tie::File::AsHash", "t/testfile", split => ":", recsep => "\n"), "tie");
+
+my @vals_from_testfile = values %hash;
+
+# yes, vals are in order, though that may change
+ok("@vals" eq "@vals_from_testfile");
@@ -1,14 +0,0 @@
-use Test::More tests => 3;
-
-BEGIN { use_ok('Tie::File::AsHash') };
-
-my %hash;
-
-my @vals = qw/line bar uno dos baz line/;
-
-ok((tie %hash, "Tie::File::AsHash", "t/testfile", split => ":", recsep => "\n"), "tie");
-
-my @vals_from_testfile = values %hash;
-
-# yes, vals are in order, though that may change
-ok("@vals" eq "@vals_from_testfile");
@@ -0,0 +1,21 @@
+use Test::More tests => 3;
+
+BEGIN { use_ok('Tie::File::AsHash') };
+
+my %hash;
+
+my @vals = qw/line bar uno dos bar line/;
+
+ok((my $obj = tie %hash, "Tie::File::AsHash", "t/testfile", split => ":", recsep => "\n"), "tie");
+
+my $vals;
+
+while (my ($key, $val) = each %hash)
+{
+
+ $vals++;
+
+}
+
+# yes, hashes are in same order, though that may change
+ok($vals == $obj->SCALAR());
@@ -1,21 +0,0 @@
-use Test::More tests => 3;
-
-BEGIN { use_ok('Tie::File::AsHash') };
-
-my %hash;
-
-my @vals = qw/line bar uno dos bar line/;
-
-ok((my $obj = tie %hash, "Tie::File::AsHash", "t/testfile", split => ":", recsep => "\n"), "tie");
-
-my $vals;
-
-while (my ($key, $val) = each %hash)
-{
-
- $vals++;
-
-}
-
-# yes, hashes are in same order, though that may change
-ok($vals == $obj->SCALAR());