Edit D:\app\Administrator\product\11.2.0\dbhome_1\perl\html\lib\Tie\Memoize.html
<?xml version="1.0" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Tie::Memoize - add data to hash when needed</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rev="made" href="mailto:" /> </head> <body style="background-color: white"> <table border="0" width="100%" cellspacing="0" cellpadding="3"> <tr><td class="block" style="background-color: #cccccc" valign="middle"> <big><strong><span class="block"> Tie::Memoize - add data to hash when needed</span></strong></big> </td></tr> </table> <!-- INDEX BEGIN --> <div name="index"> <p><a name="__index__"></a></p> <ul> <li><a href="#name">NAME</a></li> <li><a href="#synopsis">SYNOPSIS</a></li> <li><a href="#description">DESCRIPTION</a></li> <li><a href="#inheriting_from_tie__memoize">Inheriting from <strong>Tie::Memoize</strong></a></li> <li><a href="#example">EXAMPLE</a></li> <li><a href="#bugs">BUGS</a></li> <li><a href="#author">AUTHOR</a></li> </ul> <hr name="index" /> </div> <!-- INDEX END --> <p> </p> <h1><a name="name">NAME</a></h1> <p>Tie::Memoize - add data to hash when needed</p> <p> </p> <hr /> <h1><a name="synopsis">SYNOPSIS</a></h1> <pre> require Tie::Memoize; tie %hash, 'Tie::Memoize', \&fetch, # The rest is optional $DATA, \&exists, {%ini_value}, {%ini_existence};</pre> <p> </p> <hr /> <h1><a name="description">DESCRIPTION</a></h1> <p>This package allows a tied hash to autoload its values on the first access, and to use the cached value on the following accesses.</p> <p>Only read-accesses (via fetching the value or <a href="file://C|\ADE\aime_smenon_perl_090715\perl\html/pod/perlfunc.html#exists"><code>exists</code></a>) result in calls to the functions; the modify-accesses are performed as on a normal hash.</p> <p>The required arguments during <a href="file://C|\ADE\aime_smenon_perl_090715\perl\html/pod/perlfunc.html#tie"><code>tie</code></a> are the hash, the package, and the reference to the <code>FETCH</code>ing function. The optional arguments are an arbitrary scalar $data, the reference to the <code>EXISTS</code> function, and initial values of the hash and of the existence cache.</p> <p>Both the <code>FETCH</code>ing function and the <code>EXISTS</code> functions have the same signature: the arguments are <code>$key, $data</code>; $data is the same value as given as argument during tie()ing. Both functions should return an empty list if the value does not exist. If <code>EXISTS</code> function is different from the <code>FETCH</code>ing function, it should return a TRUE value on success. The <code>FETCH</code>ing function should return the intended value if the key is valid.</p> <p> </p> <hr /> <h1><a name="inheriting_from_tie__memoize">Inheriting from <strong>Tie::Memoize</strong></a></h1> <p>The structure of the <a href="file://C|\ADE\aime_smenon_perl_090715\perl\html/pod/perlfunc.html#tied"><code>tied()</code></a> data is an array reference with elements</p> <pre> 0: cache of known values 1: cache of known existence of keys 2: FETCH function 3: EXISTS function 4: $data</pre> <p>The rest is for internal usage of this package. In particular, if TIEHASH is overwritten, it should call SUPER::TIEHASH.</p> <p> </p> <hr /> <h1><a name="example">EXAMPLE</a></h1> <pre> sub slurp { my ($key, $dir) = shift; open my $h, '<', "$dir/$key" or return; local $/; <$h> # slurp it all } sub exists { my ($key, $dir) = shift; return -f "$dir/$key" }</pre> <pre> tie %hash, 'Tie::Memoize', \&slurp, $directory, \&exists, { fake_file1 => $content1, fake_file2 => $content2 }, { pretend_does_not_exists => 0, known_to_exist => 1 };</pre> <p>This example treats the slightly modified contents of $directory as a hash. The modifications are that the keys <em class="file">fake_file1</em> and <em class="file">fake_file2</em> fetch values $content1 and $content2, and <em class="file">pretend_does_not_exists</em> will never be accessed. Additionally, the existence of <em class="file">known_to_exist</em> is never checked (so if it does not exists when its content is needed, the user of %hash may be confused).</p> <p> </p> <hr /> <h1><a name="bugs">BUGS</a></h1> <p>FIRSTKEY and NEXTKEY methods go through the keys which were already read, not all the possible keys of the hash.</p> <p> </p> <hr /> <h1><a name="author">AUTHOR</a></h1> <p>Ilya Zakharevich <em><a href="mailto:mailto:perl-module-hash-memoize@ilyaz.org">mailto:perl-module-hash-memoize@ilyaz.org</a></em>.</p> <table border="0" width="100%" cellspacing="0" cellpadding="3"> <tr><td class="block" style="background-color: #cccccc" valign="middle"> <big><strong><span class="block"> Tie::Memoize - add data to hash when needed</span></strong></big> </td></tr> </table> </body> </html>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de