[mylvmbackup] Support for Perl Modules as hooks

http://bazaar.launchpad.net/~mboehm/+junk/mylvmbackup/revision/83

My branch is based off of rev 85. I included some sample hook scripts to 
illustrate their use. Previously, I was patching the main source file to 
include some custom stuff. Being able to "extend" the $dbh object into the hook 
scripts allowed me to stop having to modify the core code and only change the 
hook code.

* Added support for using Perl modules as hook scripts. Module
  must be named <hook>.pm and must be a package of type <hook>.
  Module must implement ->execute() which is called by mylvmbackup
  to initiate the hook. It must return boolean true/false (1 or 0)
  on success/failure.

  ->execute() will be passed 2 parameters. The first parameter
  is a clone() of the global $dbh. This will allow hook scripts
  to preform actions on the DB using the existing connection. The
  second parameter is a string containing any messages passed to
  the run_hook() function.

  Module must also implement ->errmsg() which will return a string
  error message to be sent to log_msg(). This will be called by
  mylvmbackup when ->execute() returns false/0.

* Added new hook, 'logerr'. Called by log_msg() when log severity
  is LOG_ERR. Passes $msg to hook script.

Matthew Boehm
Senior MySQL DBA, The Planet - Northstar Managed Hosting
Certified MySQL 5.0 DBA
Certified MySQL 5.1 Cluster DBA
Office: 281-714-4018
Mobile: 832-253-8258
Email: mboehm@xxxxxxxxxxxxx



Other related posts: