HIDDEN
input fields in forms. Only a limited amount of
data can be stored in this way, but it is quick and easy.More sophisticated methods might rely on Netscape Cookies, or storing the name of a temporary file in a hidden variable, etc.
The following routines pack and restore pairs of points into a string
of the form x1 z y1 q x2 z y2 q .... They use the global
variables $history
for the string and
@hx,@hy
for the arrays of points.
The Graphing demo has a full example illustrating how to use these routines in a form to implement persistant memory.sub pack_history ( $hl = $#hx; if ($hl > 10) {$hl = 10;} # limit to 10 pairs $history = ""; for $i (0..$hl) { $history .= $hx[$i]."z".$hy[$i]."q"; } } sub expand_history ( @pairs = split('q',$history); $i = $#pairs; foreach $i (0..$#pairs) { ($hx[$i], $hy[$i]) = split('z',$pairs[$i]); } }
# Scan for old files and erase them. opendir(WORKDIR, $WORKDIR); $old = time() - 600; # "Old" files haven't been touched in 600 sec=10min foreach $_ (readdir(WORKDIR)) { if(/^.+$gifsuffix$/ || /^.+$pssuffix$/ ) { # any file with suffixes $thisfile=$WORKDIR . "/" . $_; @stat = stat($thisfile); # stat[8]=mtime; stat[9]=ctime unlink($thisfile) if($stat[8] < $old && $stat[9] < $old); } } close(WORKDIR);
Comments to:
webmaster@geom.umn.edu
Created: May 09 1996 ---
Last modified: Tue Jun 4 22:14:18 1996