Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

import Memoize 0.61 from CPAN

git-cpan-module:   Memoize
git-cpan-version:  0.61
git-cpan-authorid: MJD
git-cpan-file:     authors/id/M/MJ/MJD/Memoize-0.61.tar.gz
  • Loading branch information...
commit f3eca918436512ea8bf7f961d196714a2b8dbe88 1 parent 45a353b
Mark Jason Dominus (陶敏修) authored schwern committed

Showing 3 changed files with 45 additions and 2 deletions. Show diff stats Hide diff stats

  1. +1 0  MANIFEST
  2. +2 2 Memoize.pm
  3. +42 0 t/flush.t
1  MANIFEST
@@ -27,6 +27,7 @@ t/expire.t
27 27 t/expire_module_n.t
28 28 t/expire_module_t.t
29 29 t/expire_file.t
  30 +t/flush.t
30 31 article.html
31 32 demo.pl
32 33 demo2.pl
4 Memoize.pm
@@ -8,10 +8,10 @@
8 8 # same terms as Perl itself. If in doubt,
9 9 # write to mjd-perl-memoize+@plover.com for a license.
10 10 #
11   -# Version 0.52 beta $Revision: 1.14 $ $Date: 1999/09/17 14:55:57 $
  11 +# Version 0.61 beta $Revision: 1.17 $ $Date: 2000/10/24 04:33:49 $
12 12
13 13 package Memoize;
14   -$VERSION = '0.60';
  14 +$VERSION = '0.61';
15 15
16 16 # Compile-time constants
17 17 sub SCALAR () { 0 }
42 t/flush.t
... ... @@ -0,0 +1,42 @@
  1 +#!/usr/bin/perl
  2 +
  3 +use lib '..';
  4 +use Memoize 'flush_cache', 'memoize';
  5 +print "1..8\n";
  6 +print "ok 1\n";
  7 +
  8 +
  9 +
  10 +my $V = 100;
  11 +sub VAL { $V }
  12 +
  13 +memoize 'VAL';
  14 +print "ok 2\n";
  15 +
  16 +my $c1 = VAL();
  17 +print (($c1 == 100) ? "ok 3\n" : "not ok 3\n");
  18 +
  19 +$V = 200;
  20 +$c1 = VAL();
  21 +print (($c1 == 100) ? "ok 4\n" : "not ok 4\n");
  22 +
  23 +flush_cache('VAL');
  24 +$c1 = VAL();
  25 +print (($c1 == 200) ? "ok 5\n" : "not ok 5\n");
  26 +
  27 +$V = 300;
  28 +$c1 = VAL();
  29 +print (($c1 == 200) ? "ok 6\n" : "not ok 6\n");
  30 +
  31 +flush_cache(\&VAL);
  32 +$c1 = VAL();
  33 +print (($c1 == 300) ? "ok 7\n" : "not ok 7\n");
  34 +
  35 +$V = 400;
  36 +$c1 = VAL();
  37 +print (($c1 == 300) ? "ok 8\n" : "not ok 8\n");
  38 +
  39 +
  40 +
  41 +
  42 +

0 comments on commit f3eca91

Please sign in to comment.
Something went wrong with that request. Please try again.