NAME
FSFAST::Misc -- Miscellaneous functions useful for processing FS-FAST and Freesurfer data
SYNOPSIS
use FSFAST::Misc qw/:log/ -- log file functions logfile_start($ROIdata); logfile("Hello, logfile");
use FSFAST::Misc qw/:msg/ -- messaging functions errmsg(121);
DESCRIPTION
The module provides miscellaneous functions that are used in other FSFAST modules, such as FSFAST::Parse and FSFAST::ROI.
No functions are imported into the caller's namespace by default, but rather are used by the export tags ``log'' and ``msg''.
log
This tag imports two functions logfile_start
and logfile
. Both are described completely in the METHODS section, but in brief, logfile_start
wants a ROIdata hash (see the FSFAST::Parse manpage) from which it will create and open a logfile, while logfile
will write information to the logfile (and optionally, to standard output).
msg
Presently, the ``msg'' tag only imports one function, errmsg
. This function expects a numerical error code which is then converted into a meaningful error message and printed to standard output. Other message functions will be added.
METHODS
The only methods that should be publicly used are logfile_start
, logfile
, and errmsg
.
logfile_start
Creates and opens a logfile by calling _logfile_open
, it expects a ROIdata hash. This function is separate from logfile
to prevent the need to pass the ROIdata hash to logfile for each call.
_logfile_open
Creates and opens a logfile. _logfile_open
expects a ROIdata hash with three required paramters: prog_name, which is the name of the program writing to the log; roi, the name of the roi being used (the default is 'none'); and sessid, the session id for the analysis. These values form integral parts of the logfile name, thereby discriminating the logfile from similar logfiles from other analyses. The default location to store the logfiles is a directory called ``log'' underneath the current working directory.
logfile
Prints a message to the logfile. The first argument is required and is the message to print; the second argument is whether or not to ``display'' the message on standard output as well as in the logfile; the third argument is an ROIdata hash, if you have not run logfile_start
previously. The message is written to the logfile only, unless $display or $debug is set; in that case, the message is display onscreen as well.
_logfile_close
Closes a logfile. Takes no paramters as it uses the global $logfile_handle variable.
logfile_timestamp
Gets and returns a formatted timestamp string for writing in a logfile.
errmsg
Displays an error message based on an error code. Obsfucates the code slightly, but makes for easier updating of error messages.
DESTROY
Closes the logfile when the last instance of this object disappears.
Developer's note: writing ``DESTROY'' in all caps makes me think of Godzilla. This will not wipe out a city, however.
REVISION
$Id: Misc.pm,v 1.10 2003/09/09 18:47:39 nknouf Exp $
AUTHOR
Nicholas Knouf, <nknouf@mit.edu>, <nknouf@mimeme.net>
COPYRIGHT
Copyright (c) 2003, Nicholas Knouf, MIT
LICENSE
All rights reserved. This is free software; you can redistribute it and/or modify it under the same terms as Perl itself.