From: Steffen Mueller Date: Thu, 3 Sep 2009 15:29:56 +0000 (+0200) Subject: Move Tie::Memoize from lib to ext X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b7d7e1dad734d27d791c1f48094cb4b84f6c6165;p=p5sagit%2Fp5-mst-13.2.git Move Tie::Memoize from lib to ext --- diff --git a/MANIFEST b/MANIFEST index 4c8531a..76e641c 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1689,6 +1689,8 @@ ext/Tie-File/t/33_defer_vs.t Like 30_defer.t, but with varying-length records ext/Tie-File/t/40_abs_cache.t Unit tests for Tie::File::Cache ext/Tie-File/t/41_heap.t Unit tests for Tie::File::Heap ext/Tie-File/t/42_offset.t Unit tests for the offset method +ext/Tie-Memoize/lib/Tie/Memoize.pm Base class for memoized tied hashes +ext/Tie-Memoize/t/Tie-Memoize.t Test for Tie::Memoize ext/Time-HiRes/Changes Time::HiRes extension ext/Time-HiRes/fallback/const-c.inc Time::HiRes extension ext/Time-HiRes/fallback/const-xs.inc Time::HiRes extension @@ -3375,8 +3377,6 @@ lib/Tie/Handle/stdhandle_from_handle.t Test for Tie::StdHandle/Handle backwards lib/Tie/Handle/stdhandle.t Test for Tie::StdHandle lib/Tie/Hash/NamedCapture.pm Implements %- and %+ behaviour lib/Tie/Hash.pm Base class for tied hashes -lib/Tie/Memoize.pm Base class for memoized tied hashes -lib/Tie/Memoize.t Test for Memoize.t lib/Tie/RefHash.pm Base class for tied hashes with references as keys lib/Tie/RefHash/rebless.t Test for Tie::RefHash with rebless lib/Tie/RefHash/refhash.t Test for Tie::RefHash and Tie::RefHash::Nestable diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index b23e480..c549d7c 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -2063,6 +2063,7 @@ package Maintainers; ext/SDBM_File/ ext/Socket/ ext/Sys-Hostname/ + ext/Tie-Memoize/ ext/XS-APItest/ ext/XS-Typemap/ ext/attributes/ @@ -2132,7 +2133,6 @@ package Maintainers; lib/Tie/Handle/ lib/Tie/Hash.pm lib/Tie/Hash/NamedCapture.pm - lib/Tie/Memoize.{pm,t} lib/Tie/Scalar.{pm,t} lib/Tie/StdHandle.pm lib/Tie/SubstrHash.{pm,t} diff --git a/ext/.gitignore b/ext/.gitignore index 78b4a02..907f390 100644 --- a/ext/.gitignore +++ b/ext/.gitignore @@ -48,6 +48,7 @@ ppport.h /Thread-Queue/Makefile.PL /Thread-Semaphore/Makefile.PL /Tie-File/Makefile.PL +/Tie-Memoize/Makefile.PL # ignore all vim swap files but the one bundled in Module::Pluggable for testing *.swp diff --git a/lib/Tie/Memoize.pm b/ext/Tie-Memoize/lib/Tie/Memoize.pm similarity index 100% rename from lib/Tie/Memoize.pm rename to ext/Tie-Memoize/lib/Tie/Memoize.pm diff --git a/lib/Tie/Memoize.t b/ext/Tie-Memoize/t/Tie-Memoize.t similarity index 66% rename from lib/Tie/Memoize.t rename to ext/Tie-Memoize/t/Tie-Memoize.t index defb437..4b5c759 100644 --- a/lib/Tie/Memoize.t +++ b/ext/Tie-Memoize/t/Tie-Memoize.t @@ -1,13 +1,8 @@ #!./perl -w -BEGIN { - chdir 't' if -d 't'; - @INC = '../lib'; -} - use strict; use Tie::Memoize; -use Test::More tests => 28; +use Test::More tests => 27; use File::Spec; sub slurp { @@ -18,7 +13,9 @@ sub slurp { } sub exists { my ($key, $dir) = @_; return -f File::Spec->catfile($dir, $key) } -my $directory = File::Spec->catdir(File::Spec->updir, 'lib'); +chdir(File::Spec->updir()) if not -d 't'; + +my $directory = File::Spec->catdir('lib', 'Tie'); tie my %hash, 'Tie::Memoize', \&slurp, $directory, \&exists, { fake_file1 => 123, fake_file2 => 45678 }, @@ -34,10 +31,10 @@ ok(not defined $hash{fake_file3}); ok(not defined $hash{known_to_exist}); ok(not exists $hash{known_to_exist}); ok(not exists $hash{'strict.pm'}); -my $c = slurp('constant.pm', $directory); +my $c = slurp('Memoize.pm', $directory); ok($c); -ok($hash{'constant.pm'} eq $c); -ok($hash{'constant.pm'} eq $c); +ok($hash{'Memoize.pm'} eq $c); +ok($hash{'Memoize.pm'} eq $c); ok(not exists $hash{'strict.pm'}); ok(exists $hash{'blib.pm'}); @@ -45,17 +42,16 @@ untie %hash; tie %hash, 'Tie::Memoize', \&slurp, $directory; -ok(exists $hash{'strict.pm'}, 'existing file'); +ok(exists $hash{'Memoize.pm'}, 'existing file'); ok(not exists $hash{fake_file2}); ok(not exists $hash{fake_file1}); ok(not exists $hash{known_to_exist}); -ok(exists $hash{'strict.pm'}, 'existing file again'); +ok(exists $hash{'Memoize.pm'}, 'existing file again'); ok(not defined $hash{fake_file3}); ok(not defined $hash{known_to_exist}); ok(not exists $hash{known_to_exist}); -ok(exists $hash{'strict.pm'}, 'existing file again'); -ok($hash{'constant.pm'} eq $c); -ok($hash{'constant.pm'} eq $c); -ok(exists $hash{'strict.pm'}, 'existing file again'); -ok(exists $hash{'blib.pm'}, 'another existing file'); +ok(exists $hash{'Memoize.pm'}, 'existing file again'); +ok($hash{'Memoize.pm'} eq $c); +ok($hash{'Memoize.pm'} eq $c); +ok(exists $hash{'Memoize.pm'}, 'existing file again'); diff --git a/lib/.gitignore b/lib/.gitignore index ac4264e..dcd565b 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -88,6 +88,7 @@ /Text/Soundex.pm /Thread /Tie/File.pm +/Tie/Memoize.pm /Time/HiRes.pm /Time/Piece.pm /Time/Seconds.pm