blob: f0343b7ee4a57bf2830dc051892dc6f642f8d9dc [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Global Data</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<? prevnext "<h1>Global Data</h1>" ?>
In order to access global data, we again utilize Tcl's namespace
hierarchy:
<pre>
namespace <span class="keyword">eval</span> request {
set ::global_data [clock seconds]
}
namespace delete request
namespace <span class="keyword">eval</span> request {
puts <span class="string">&quot;The last person to access this child process came at:&quot;</span>
puts [clock format $::global_data]
}
namespace delete request</pre>
As we can see, the first request sets a variable in the global
namespace, where it won't be destroyed when the 'request'
namespace is deleted. This makes it accessible to other scripts.
<?footer?>
</body>
</html>