r9127 - in /branches/upstream/libtie-cphash-perl: ./ current/ current/lib/ current/lib/Tie/ current/t/

emhn-guest at users.alioth.debian.org emhn-guest at users.alioth.debian.org
Fri Nov 9 22:19:41 UTC 2007


Author: emhn-guest
Date: Fri Nov  9 22:19:40 2007
New Revision: 9127

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

Added:
    branches/upstream/libtie-cphash-perl/
    branches/upstream/libtie-cphash-perl/current/
    branches/upstream/libtie-cphash-perl/current/Build.PL
    branches/upstream/libtie-cphash-perl/current/Changes
    branches/upstream/libtie-cphash-perl/current/MANIFEST
    branches/upstream/libtie-cphash-perl/current/META.yml
    branches/upstream/libtie-cphash-perl/current/Makefile.PL
    branches/upstream/libtie-cphash-perl/current/My_Build.pm
    branches/upstream/libtie-cphash-perl/current/README
    branches/upstream/libtie-cphash-perl/current/lib/
    branches/upstream/libtie-cphash-perl/current/lib/Tie/
    branches/upstream/libtie-cphash-perl/current/lib/Tie/CPHash.pm
    branches/upstream/libtie-cphash-perl/current/t/
    branches/upstream/libtie-cphash-perl/current/t/00.load.t
    branches/upstream/libtie-cphash-perl/current/t/10.CPHash.t
    branches/upstream/libtie-cphash-perl/current/t/pod-coverage.t
    branches/upstream/libtie-cphash-perl/current/t/pod.t

Added: branches/upstream/libtie-cphash-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libtie-cphash-perl/current/Build.PL?rev=9127&op=file
==============================================================================
--- branches/upstream/libtie-cphash-perl/current/Build.PL (added)
+++ branches/upstream/libtie-cphash-perl/current/Build.PL Fri Nov  9 22:19:40 2007
@@ -1,0 +1,32 @@
+#! /usr/bin/perl
+#---------------------------------------------------------------------
+# $Id: Build.PL 1714 2007-03-22 21:31:33Z cjm $
+# Copyright 2007 Christopher J. Madsen
+#
+# Build.PL for Tie-CPHash
+#---------------------------------------------------------------------
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib $FindBin::Bin; # Make sure we're using My_Build from our distribution
+
+use My_Build;          # Our customized version of Module::Build
+
+my $builder = My_Build->new(
+  module_name        => 'Tie::CPHash',
+  license            => 'perl',
+  dist_author        => 'Christopher J. Madsen <perl at cjmweb.net>',
+  dist_version_from  => 'lib/Tie/CPHash.pm',
+  build_requires => {
+      'FindBin'       => 0,
+      'File::Spec'    => 0,
+      'Module::Build' => 0.21,
+      'Test::More'    => 0,
+  },
+  create_makefile_pl => 'passthrough',
+  dynamic_config     => 0,
+);
+
+$builder->create_build_script();

Added: branches/upstream/libtie-cphash-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libtie-cphash-perl/current/Changes?rev=9127&op=file
==============================================================================
--- branches/upstream/libtie-cphash-perl/current/Changes (added)
+++ branches/upstream/libtie-cphash-perl/current/Changes Fri Nov  9 22:19:40 2007
@@ -1,0 +1,17 @@
+Revision history for Perl extension Tie::CPHash.
+
+1.03   Mar 22 2007
+        - no functional changes
+        - converted to Module::Build
+        - added tests
+        - updated my email address
+
+1.02   Mar 12 2006
+        - Added SCALAR method (thanks to Yitzchak Scott-Thoennes)
+        - updated my email address
+
+1.001  Oct 25 1998
+        - updated my email address
+
+1.000  Jan 15 1998
+	- First public release; created by h2xs 1.18

Added: branches/upstream/libtie-cphash-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/libtie-cphash-perl/current/MANIFEST?rev=9127&op=file
==============================================================================
--- branches/upstream/libtie-cphash-perl/current/MANIFEST (added)
+++ branches/upstream/libtie-cphash-perl/current/MANIFEST Fri Nov  9 22:19:40 2007
@@ -1,0 +1,12 @@
+Build.PL
+Changes				Revision history
+lib/Tie/CPHash.pm		The Tie::CPHash module
+Makefile.PL			MakeMaker compatible wrapper
+MANIFEST			See MANIFEST
+META.yml			Module meta-data (added by Module::Build)
+My_Build.pm			Customize Module::Build
+README				About the Tie::CPHash module
+t/00.load.t
+t/10.CPHash.t			Testing... 1, 2, 3, Testing... 1, 2, 3
+t/pod-coverage.t
+t/pod.t

Added: branches/upstream/libtie-cphash-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libtie-cphash-perl/current/META.yml?rev=9127&op=file
==============================================================================
--- branches/upstream/libtie-cphash-perl/current/META.yml (added)
+++ branches/upstream/libtie-cphash-perl/current/META.yml Fri Nov  9 22:19:40 2007
@@ -1,0 +1,23 @@
+---
+name: Tie-CPHash
+version: 1.03
+author:
+  - Christopher J. Madsen <perl at cjmweb.net>
+abstract: Case preserving but case insensitive hash table
+license: perl
+resources:
+  license: http://dev.perl.org/licenses/
+build_requires:
+  File::Spec: 0
+  FindBin: 0
+  Module::Build: 0.21
+  Test::More: 0
+dynamic_config: 0
+provides:
+  Tie::CPHash:
+    file: lib/Tie/CPHash.pm
+    version: 1.03
+generated_by: Module::Build version 0.2805
+meta-spec:
+  url: http://module-build.sourceforge.net/META-spec-v1.2.html
+  version: 1.2

Added: branches/upstream/libtie-cphash-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libtie-cphash-perl/current/Makefile.PL?rev=9127&op=file
==============================================================================
--- branches/upstream/libtie-cphash-perl/current/Makefile.PL (added)
+++ branches/upstream/libtie-cphash-perl/current/Makefile.PL Fri Nov  9 22:19:40 2007
@@ -1,0 +1,31 @@
+# Note: this file was auto-generated by Module::Build::Compat version 0.03
+    
+    unless (eval "use Module::Build::Compat 0.02; 1" ) {
+      print "This module requires Module::Build to install itself.\n";
+      
+      require ExtUtils::MakeMaker;
+      my $yn = ExtUtils::MakeMaker::prompt
+	('  Install Module::Build now from CPAN?', 'y');
+      
+      unless ($yn =~ /^y/i) {
+	die " *** Cannot install without Module::Build.  Exiting ...\n";
+      }
+      
+      require Cwd;
+      require File::Spec;
+      require CPAN;
+      
+      # Save this 'cause CPAN will chdir all over the place.
+      my $cwd = Cwd::cwd();
+      
+      CPAN::Shell->install('Module::Build::Compat');
+      CPAN::Shell->expand("Module", "Module::Build::Compat")->uptodate
+	or die "Couldn't install Module::Build, giving up.\n";
+      
+      chdir $cwd or die "Cannot chdir() back to $cwd: $!";
+    }
+    eval "use Module::Build::Compat 0.02; 1" or die $@;
+    use lib '.';
+    Module::Build::Compat->run_build_pl(args => \@ARGV);
+    require My_Build;
+    Module::Build::Compat->write_makefile(build_class => 'My_Build');

Added: branches/upstream/libtie-cphash-perl/current/My_Build.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libtie-cphash-perl/current/My_Build.pm?rev=9127&op=file
==============================================================================
--- branches/upstream/libtie-cphash-perl/current/My_Build.pm (added)
+++ branches/upstream/libtie-cphash-perl/current/My_Build.pm Fri Nov  9 22:19:40 2007
@@ -1,0 +1,64 @@
+#---------------------------------------------------------------------
+# $Id: My_Build.pm 1714 2007-03-22 21:31:33Z cjm $
+package My_Build;
+#
+# Copyright 2007 Christopher J. Madsen
+#
+# Author: Christopher J. Madsen <perl at cjmweb.net>
+# Created: 18 Feb 2007
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the same terms as Perl itself.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See either the
+# GNU General Public License or the Artistic License for more details.
+#
+# Customize Module::Build for Tie::CPHash
+#---------------------------------------------------------------------
+
+use strict;
+use File::Spec ();
+use base 'Module::Build';
+
+#=====================================================================
+# Package Global Variables:
+
+our $VERSION = '1.00';
+
+#=====================================================================
+sub ACTION_distdir
+{
+  my $self = shift @_;
+
+  $self->SUPER::ACTION_distdir(@_);
+
+  # Process README, inserting version number & removing comments:
+
+  my $out = File::Spec->catfile($self->dist_dir, 'README');
+  my @stat = stat($out) or die;
+
+  unlink $out or die;
+
+  open(IN,  '<', 'README') or die;
+  open(OUT, '>', $out)     or die;
+
+  while (<IN>) {
+    next if /^\$\$/;            # $$ indicates comment
+    s/\$\%v\%\$/ $self->dist_version /ge;
+
+    print OUT $_;
+  } # end while IN
+
+  close IN;
+  close OUT;
+
+  utime @stat[8,9], $out;       # Restore modification times
+  chmod $stat[2],   $out;       # Restore access permissions
+} # end ACTION_distdir
+
+#=====================================================================
+# Package Return Value:
+
+1;

Added: branches/upstream/libtie-cphash-perl/current/README
URL: http://svn.debian.org/wsvn/branches/upstream/libtie-cphash-perl/current/README?rev=9127&op=file
==============================================================================
--- branches/upstream/libtie-cphash-perl/current/README (added)
+++ branches/upstream/libtie-cphash-perl/current/README Fri Nov  9 22:19:40 2007
@@ -1,0 +1,24 @@
+Tie::CPHash 1.03
+Copyright 1997 Christopher J. Madsen
+
+DESCRIPTION
+
+    This module provides a case preserving but case insensitive hash.
+    This means that
+
+        $cphash{KEY}    $cphash{key}
+        $cphash{Key}    $cphash{keY}
+
+    all refer to the same entry.  Also, the hash remembers which form of
+    the key was last used to store the entry.  The `keys' and `each'
+    functions will return the key that was used to set the value.
+
+LICENSE
+
+    This program is free software; you can redistribute it and/or modify
+    it under the same terms as Perl itself.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See either the
+    GNU General Public License or the Artistic License for more details.

Added: branches/upstream/libtie-cphash-perl/current/lib/Tie/CPHash.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libtie-cphash-perl/current/lib/Tie/CPHash.pm?rev=9127&op=file
==============================================================================
--- branches/upstream/libtie-cphash-perl/current/lib/Tie/CPHash.pm (added)
+++ branches/upstream/libtie-cphash-perl/current/lib/Tie/CPHash.pm Fri Nov  9 22:19:40 2007
@@ -1,0 +1,203 @@
+#---------------------------------------------------------------------
+package Tie::CPHash;
+#
+# Copyright 1997 Christopher J. Madsen
+#
+# Author: Christopher J. Madsen <perl at cjmweb.net>
+# Created: 08 Nov 1997
+# $Id: CPHash.pm 1714 2007-03-22 21:31:33Z cjm $
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the same terms as Perl itself.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See either the
+# GNU General Public License or the Artistic License for more details.
+#
+# Case preserving but case insensitive hash
+#---------------------------------------------------------------------
+
+require 5.000;
+use strict;
+use vars qw(@ISA $VERSION);
+
+ at ISA = qw();
+
+#=====================================================================
+# Package Global Variables:
+
+$VERSION = '1.03';
+
+#=====================================================================
+# Tied Methods:
+#---------------------------------------------------------------------
+# TIEHASH classname
+#      The method invoked by the command `tie %hash, classname'.
+#      Associates a new hash instance with the specified class.
+
+sub TIEHASH
+{
+    bless {}, $_[0];
+} # end TIEHASH
+
+#---------------------------------------------------------------------
+# STORE this, key, value
+#      Store datum *value* into *key* for the tied hash *this*.
+
+sub STORE
+{
+    $_[0]->{lc $_[1]} = [ $_[1], $_[2] ];
+} # end STORE
+
+#---------------------------------------------------------------------
+# FETCH this, key
+#      Retrieve the datum in *key* for the tied hash *this*.
+
+sub FETCH
+{
+    my $v = $_[0]->{lc $_[1]};
+    ($v ? $v->[1] : undef);
+} # end FETCH
+
+#---------------------------------------------------------------------
+# FIRSTKEY this
+#      Return the (key, value) pair for the first key in the hash.
+
+sub FIRSTKEY
+{
+    my $a = scalar keys %{$_[0]};
+    &NEXTKEY;
+} # end FIRSTKEY
+
+#---------------------------------------------------------------------
+# NEXTKEY this, lastkey
+#      Return the next (key, value) pair for the hash.
+
+sub NEXTKEY
+{
+    my $v = (each %{$_[0]})[1];
+    ($v ? $v->[0] : undef );
+} # end NEXTKEY
+
+#---------------------------------------------------------------------
+# SCALAR this
+#     Return bucket usage information for the hash (0 if empty).
+
+sub SCALAR
+{
+    scalar %{$_[0]};
+} # end SCALAR
+
+#---------------------------------------------------------------------
+# EXISTS this, key
+#     Verify that *key* exists with the tied hash *this*.
+
+sub EXISTS
+{
+    exists $_[0]->{lc $_[1]};
+} # end EXISTS
+
+#---------------------------------------------------------------------
+# DELETE this, key
+#     Delete the key *key* from the tied hash *this*.
+#     Returns the old value, or undef if it didn't exist.
+
+sub DELETE
+{
+    my $v = delete $_[0]->{lc $_[1]};
+    ($v ? $v->[1] : undef);
+} # end DELETE
+
+#---------------------------------------------------------------------
+# CLEAR this
+#     Clear all values from the tied hash *this*.
+
+sub CLEAR
+{
+    %{$_[0]} = ();
+} # end CLEAR
+
+#=====================================================================
+# Other Methods:
+#---------------------------------------------------------------------
+# Return the case of KEY.
+
+sub key
+{
+    my $v = $_[0]->{lc $_[1]};
+    ($v ? $v->[0] : undef);
+}
+
+#=====================================================================
+# Package Return Value:
+
+1;
+
+__END__
+
+=head1 NAME
+
+Tie::CPHash - Case preserving but case insensitive hash table
+
+=head1 SYNOPSIS
+
+    require Tie::CPHash;
+    tie %cphash, 'Tie::CPHash';
+
+    $cphash{'Hello World'} = 'Hi there!';
+    printf("The key `%s' was used to store `%s'.\n",
+           tied(%cphash)->key('HELLO WORLD'),
+           $cphash{'HELLO world'});
+
+=head1 DESCRIPTION
+
+The B<Tie::CPHash> module provides a hash table that is case
+preserving but case insensitive.  This means that
+
+    $cphash{KEY}    $cphash{key}
+    $cphash{Key}    $cphash{keY}
+
+all refer to the same entry.  Also, the hash remembers which form of
+the key was last used to store the entry.  The C<keys> and C<each>
+functions will return the key that was used to set the value.
+
+An example should make this clear:
+
+    tie %h, 'Tie::CPHash';
+    $h{Hello} = 'World';
+    print $h{HELLO};            # Prints 'World'
+    print keys(%h);             # Prints 'Hello'
+    $h{HELLO} = 'WORLD';
+    print $h{hello};            # Prints 'WORLD'
+    print keys(%h);             # Prints 'HELLO'
+
+The additional C<key> method lets you fetch the case of a specific key:
+
+    # When run after the previous example, this prints 'HELLO':
+    print tied(%h)->key('Hello');
+
+(The C<tied> function returns the object that C<%h> is tied to.)
+
+If you need a case insensitive hash, but don't need to preserve case,
+just use C<$hash{lc $key}> instead of C<$hash{$key}>.  This has a lot
+less overhead than B<Tie::CPHash>.
+
+=head1 LICENSE
+
+Tie::CPHash is distributed under the same terms as Perl itself.
+
+This means it is distributed in the hope that it will be useful, but
+I<without any warranty>; without even the implied warranty of
+I<merchantability> or I<fitness for a particular purpose>.  See the
+GNU General Public License or the Artistic License for more details.
+
+=head1 AUTHOR
+
+Christopher J. Madsen E<lt>F<perl AT cjmweb.net>E<gt>
+
+Please send bug reports to F<bug-Tie-CPHash AT rt.cpan.org>, or
+use the web interface at
+L<http://rt.cpan.org/Public/Bug/Report.html?Queue=Tie-CPHash>
+
+=cut

Added: branches/upstream/libtie-cphash-perl/current/t/00.load.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtie-cphash-perl/current/t/00.load.t?rev=9127&op=file
==============================================================================
--- branches/upstream/libtie-cphash-perl/current/t/00.load.t (added)
+++ branches/upstream/libtie-cphash-perl/current/t/00.load.t Fri Nov  9 22:19:40 2007
@@ -1,0 +1,12 @@
+#! /usr/bin/perl
+#---------------------------------------------------------------------
+# $Id: 00.load.t 1714 2007-03-22 21:31:33Z cjm $
+#---------------------------------------------------------------------
+
+use Test::More tests => 1;
+
+BEGIN {
+use_ok( 'Tie::CPHash' );
+}
+
+diag( "Testing Tie::CPHash $Tie::CPHash::VERSION" );

Added: branches/upstream/libtie-cphash-perl/current/t/10.CPHash.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtie-cphash-perl/current/t/10.CPHash.t?rev=9127&op=file
==============================================================================
--- branches/upstream/libtie-cphash-perl/current/t/10.CPHash.t (added)
+++ branches/upstream/libtie-cphash-perl/current/t/10.CPHash.t Fri Nov  9 22:19:40 2007
@@ -1,0 +1,74 @@
+#! /usr/bin/perl
+#---------------------------------------------------------------------
+# $Id: 10.CPHash.t 1715 2007-03-22 23:38:37Z cjm $
+# Copyright 1997 Christopher J. Madsen
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the same terms as Perl itself.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See either the
+# GNU General Public License or the Artistic License for more details.
+#
+# Test the Tie::CPHash module
+#---------------------------------------------------------------------
+#########################
+
+use Test::More tests => 16;
+BEGIN { use_ok('Tie::CPHash') };
+
+#########################
+
+my(%h,$j,$test);
+
+tie(%h, 'Tie::CPHash');
+ok(1, 'tied %h');
+
+isa_ok(tied(%h), 'Tie::CPHash');
+
+is($h{Hello}, undef, "Hello not yet defined");
+
+ok(!exists($h{Hello}), "Hello does not exist");
+
+SKIP: {
+  skip 'SCALAR added in Perl 5.8.3', 1 unless $] >= 5.008003;
+  ok((not scalar %h), 'SCALAR empty');
+};
+
+$h{Hello} = 'World';
+$j = $h{HeLLo};
+is(           $j => 'World',  'HeLLo - World');
+is((keys %h)[-1] => 'Hello',  'last key Hello');
+
+ok(exists($h{Hello}), "Hello now exists");
+
+$h{World} = 'HW';
+$h{HELLO} = $h{World};
+is(tied(%h)->key('hello') => 'HELLO',  'last key HELLO');
+
+SKIP: {
+  skip 'SCALAR added in Perl 5.8.3', 1 unless $] >= 5.008003;
+  ok(scalar %h, 'SCALAR not empty');
+};
+
+is(delete $h{Hello}, 'HW',  "deleted Hello");
+is(delete $h{Hello}, undef, "can't delete Hello twice");
+
+SKIP: {
+  skip 'SCALAR added in Perl 5.8.3', 1 unless $] >= 5.008003;
+  ok(scalar %h, 'SCALAR still not empty');
+};
+
+is(tied(%h)->key('hello') => undef,  'hello not in keys');
+
+%h = ();
+
+SKIP: {
+  skip 'SCALAR added in Perl 5.8.3', 1 unless $] >= 5.008003;
+  ok(!scalar %h, 'SCALAR now empty');
+};
+
+# Local Variables:
+# mode: perl
+# End:

Added: branches/upstream/libtie-cphash-perl/current/t/pod-coverage.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtie-cphash-perl/current/t/pod-coverage.t?rev=9127&op=file
==============================================================================
--- branches/upstream/libtie-cphash-perl/current/t/pod-coverage.t (added)
+++ branches/upstream/libtie-cphash-perl/current/t/pod-coverage.t Fri Nov  9 22:19:40 2007
@@ -1,0 +1,12 @@
+#! /usr/bin/perl
+#---------------------------------------------------------------------
+# $Id: pod-coverage.t 1714 2007-03-22 21:31:33Z cjm $
+#---------------------------------------------------------------------
+
+use Test::More;
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
+all_pod_coverage_ok({
+  also_private => [ qr/^SCALAR$/ ],
+  trustme      => [ qr/^key$/ ],
+});

Added: branches/upstream/libtie-cphash-perl/current/t/pod.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtie-cphash-perl/current/t/pod.t?rev=9127&op=file
==============================================================================
--- branches/upstream/libtie-cphash-perl/current/t/pod.t (added)
+++ branches/upstream/libtie-cphash-perl/current/t/pod.t Fri Nov  9 22:19:40 2007
@@ -1,0 +1,9 @@
+#! /usr/bin/perl
+#---------------------------------------------------------------------
+# $Id: pod.t 1714 2007-03-22 21:31:33Z cjm $
+#---------------------------------------------------------------------
+
+use Test::More;
+eval "use Test::Pod 1.14";
+plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
+all_pod_files_ok();




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