This section documents the core WebTool::* namespace. The main module, WebTool, contains general methods which are applicable across all of the modules (read_file, write_file, audit,etc.)
The WebTool::UI namespace contains methods for creating, translating, and drawing pages to the end-user.
Finally, the WebTool::ACL module provides an interface to the Guardian Digital WebTool Access Control subsystem, the WebTool::Constants module provides, well, constants, and the WebTool::MySQL module provides an interface to the MySQL daemon.
WebTool - The core WebTool API.
use WebTool;
This module provides the core WebTool API. Functions for loading WebTool modules, creating temporary files and directories, auditing WebTool operations, and reading/writing files are all provided via a non-Object Oriented interface.
The audit($) interface is exported by default.
Basic function is to append WEBTOOL_AUDIT_LOG file. It receives one optional argument (message). In file log is written in order of Timestamp,user,filename,line.
Example usage:
$service = 'named';
if ($services->start($service) == 0) {
audit("Successfully started the '$service' service.");
}
Entry in webtool-audit.log will be something like this:
[2006/07/17 09:33:02] admin modules/services/toggle_current.cgi:42
Successfully started the 'named' service.
Basic function is to load perticular module. It receives one argument (module). New module is loaded into its own namespace. This function must be called from within BEGIN{ } block. In a result module is actully loaded using "use $module" as return value.
Example usage:
BEGIN { WebTool::load_module('services');
This function makes temporary filename. It takes a single, optional argument on what to use as the base filename(template). If you don't specify this base then 'webtool' will be used. It returns a result from running a mktemp command under WEBTOOL_TMPDIR/argument.XXXXXX .
This function generates uniquely named temporary directory. It takes a single, optional argument on what to use as the base filename(template). If you don't specify this base then ' webtool' will be used. It returns a result from running a mkdtemp command under WEBTOOL_TMPDIR/argument.XXXXXX .
Example usage:
my $tmpfile = WebTool::mktemp('apt-get');
my $ajax = new CGI::Ajax('progress' => "progress.cgi?tempfile=$tmpfile");
Ryan W. Maple <ryan@guardiandigital.com>
Copyright 2000-2005 Guardian Digital, Inc., All Rights Reserved