Taxi::Mysql::Base - Extendable full-text index using mysql: base class |
Taxi::Mysql::Base - Extendable full-text index using mysql: base class
##======================================================================== ## PRELIMINARIES
use Taxi::Mysql::Base;
##======================================================================== ## Constructors etc.
$thingy = $CLASS_OR_OBJ->new(%args); $obj2 = $obj->clone();
##======================================================================== ## Trace
undef = $obj->trace(@msg); undef = $obj->trace1(@msg);
##======================================================================== ## Verbose Messages
undef = $obj->vmsg($level, @msg); undef = $obj->vmsg1($level, @msg);
##======================================================================== ## I/O: Perl
$rc = $obj->saveFile($filename_or_fh, @args); $rc = $obj->saveString($filename_or_fh, @args);
$obj = $CLASS_OR_OBJ->loadFile($filename_or_fh, %args); $obj = $CLASS_OR_OBJ->loadString($str,%args);
$tmpData = $obj->preSaveHook(); undef = $obj->postSaveHook($tmpData); undef = $obj->postLoadHook();
##======================================================================== ## I/O: Storable
($serialied) = STORABLE_freeze($obj, $cloning_flag); undef = STORABLE_thaw($obj, $cloning, $serialized); $bool = $obj->saveBinFile($filename_or_fh); $bool = $obj->loadBinFile($filename_or_fh);
Taxi::Mysql::Base is a generic base class for persistent Taxi::Mysql objects.
$thingy = $CLASS_OR_OBJ->new(%args);
Object structure / keyword %args:
{ ##-- logging logger => $loggerClassOrObj, ##-- logger class or object: see Taxi::Mysql::Logger
##-- verbosity behavior verbose => $vlevel, ##-- default: 'default'
##-- trace (?) tracefh => $fh, ##-- filehandle for trace tracefile=>$filename, ##-- perl file spec for trace (undef for no trace) }
$obj2 = $obj->clone();
Returns a deep copy of the object. Uses the Storable module.
Destructor.
undef = $obj->trace(@msg);
Appends @msg to the selected tracefile, if any.
undef = $obj->trace1(@msg);
Appends a 1-line @msg to the selected tracefile, if any.
undef = $obj->vmsg($level, @msg);
Logs a verbose message @msg at log-level $level. @msg is only printed if $obj->{verbose} is at least $level. See Taxi::Mysql::Logger for details.
undef = $obj->vmsg1($level, @msg);
Logs a 1-line verbose message @msg at $level, prefixed with package name, terminated with newline. See Taxi::Mysql::Logger for details.
$rc = $obj->saveFile($filename_or_fh, @args);
Calls ``$obj->saveString(@args)''.
$obj = $CLASS_OR_OBJ->loadFile($filename_or_fh, %args);
Calls $CLASS_OR_OBJ->loadString(var=>undef,src=>$filename_or_fh, %args).
$tmpData = $obj->preSaveHook();
User hook. Sanitizes object for save, returns temprorary data.
undef = $obj->postSaveHook($tmpData);
User hook. Should restore any data changed or altered by preSaveHook().
$str = $obj->saveString(%args)
Saves $obj as a string of perl code. Uses Data::Dumper.
undef = $obj->postLoadHook();
User hook. Should call methods to perform post-load object initialization.
$obj = $CLASS_OR_OBJ->loadString($str,%args);
Load object contents from a string of perl code. Recognized %args:
var=>$perl_var_name, ##-- perl variable containing object reference after {eval $str} [default='$obj'] src=>$src_name, ##-- source name for error reporting; [default=(substr($str,0,42).'...')] %more_obj_args, ##-- keywords to be literally inserted into $obj
($serialied) = STORABLE_freeze($obj, $cloning_flag);
For binary storage, calls preSaveHook()
and postSaveHook().
undef = STORABLE_thaw($obj, $cloning, $serialized);
For binary restoration, probably should call postLoadHook(), but currently doesn't (and there is probably a more or less good reason for this).
Wrapper for Storable::freeze().
Wrapper for Storable::thaw().
$bool = $obj->saveBinFile($filename_or_fh);
Wrapper for Storable::store() / Storable::store_fd().
$bool = $obj->loadBinFile($filename_or_fh);
Wrapper for Storable::retrieve() / Storable::fd_retrieve().
Perl by Larry Wall.
Bryan Jurish <moocow@ling.uni-potsdam.de>
Copyright (C) 2006 by Bryan Jurish
This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.
perl(1), Taxi::Mysql(3perl), Taxi::Mysql::Logger(3perl).
Taxi::Mysql::Base - Extendable full-text index using mysql: base class |