
ClearPress::util - A database handle and utility object

$Revision: 413 $



my $oUtil = ClearPress::util->new({
'configpath' => '/path/to/config.ini', # Optional
});
my $sPath = $oUtil->data_path();
$oUtil->configpath('/path/to/configfile/');
my $sConfigPath = $oUtil->configpath();
my $oConfig = $oUtil->config();
my $sDriverName = $oUtil->driver();
my $sSection = $oUtil->dbsection();
my $oDbh = $oUtil->dbh();
my $sQuoted = $oUtil->quote($sUnquoted);
Example: A cascade of object saving
$util->transactions(0); # disable transactions
for my $subthing (@{$thing->subthings()}) { # cascade object saves (without commits)
$subthing->save();
}
$util->transactions(1); # re-enable transactions
$thing->save(); # save parent object (with commit)
$oUtil->username((getpwuid $<)[0]); $oUtil->username($sw->username()); my $sUsername = $oUtil->username();
$oUtil->cgi($oCGI); my $oCGI = $oUtil->cgi();
$oUtil->session($hrSession); my $hrSession = $oUtil->session();
$oUtil->profiler($oProfiler); my $oProf = $oUtil->profiler();
This is usually used for testing group membership for authorisation checks my $oRequestingUser = $oUtil->requestor();
$oUtil->log(@aMessages);
$oUtil->cleanup();
my $hrDBHInfo = $oUtil->db_credentials();
my $sDBName = $oUtil->dbname();
my $sDBUser = $oUtil->dbuser();
my $sDBPass = $oUtil->dbpass();
my $sDBHost = $oUtil->dbhost();
my $sDBPort = $oUtil->dbport();






Roger Pettett, <rpettett@cpan.org>

Copyright (C) 2008 Roger Pettett
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.