[interchange-cvs] interchange - jon modified 2 files
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Wed Oct 6 20:10:02 EDT 2004
User: jon
Date: 2004-10-07 00:10:02 GMT
Modified: lib/Vend Data.pm Config.pm
Log:
Add a new database configuration parameter, POSTEXPORT, which allows
calling one or more subs or globalsubs after each time that database
is exported.
Sub is called with database name, exported filename (absolute path), and
an options hash consisting of the options given to the export call and
values for 'delim' and 'record_delim' for structuring the file pointed
to by filename.
For example, it could be used to send an email notification, make a log
file entry, or do postprocessing on the exported text file.
Written and contributed by Ethan Rowe <ethan at endpoint.com> (with a little
tweaking by me).
Revision Changes Path
2.44 +14 -1 interchange/lib/Vend/Data.pm
rev 2.44, prev_rev 2.43
Index: Data.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Data.pm,v
retrieving revision 2.43
retrieving revision 2.44
diff -u -u -r2.43 -r2.44
--- Data.pm 7 Jun 2004 03:05:31 -0000 2.43
+++ Data.pm 7 Oct 2004 00:10:01 -0000 2.44
@@ -1,6 +1,6 @@
# Vend::Data - Interchange databases
#
-# $Id: Data.pm,v 2.43 2004/06/07 03:05:31 mheins Exp $
+# $Id: Data.pm,v 2.44 2004/10/07 00:10:01 jon Exp $
#
# Copyright (C) 2002-2004 Interchange Development Group
# Copyright (C) 1996-2002 Red Hat, Inc.
@@ -1401,6 +1401,19 @@
}
else {
$db->touch() unless defined $notouch;
+ }
+ if (my $subs = $db->config('POSTEXPORT')) {
+ # Make a copy of the options once to hand off to each sub.
+ my $options = { %$opt, delim => $delim, record_delim => $record_delim };
+ for my $name (@$subs) {
+ my $sub = $Vend::Cfg->{Sub}{$name} || $Global::GlobalSub->{$name}
+ or do {
+ logError("Unknown POSTEXPORT sub '%s' on database '%s'.", $name, $db->name);
+ next;
+ };
+ $sub->($db->name, $file, $options)
+ or logError("Failed call to POSTEXPORT sub '%s' on database '%s'!", $name, $db->name);
+ }
}
1;
}
2.145 +3 -2 interchange/lib/Vend/Config.pm
rev 2.145, prev_rev 2.144
Index: Config.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Config.pm,v
retrieving revision 2.144
retrieving revision 2.145
diff -u -u -r2.144 -r2.145
--- Config.pm 21 Jul 2004 05:46:55 -0000 2.144
+++ Config.pm 7 Oct 2004 00:10:01 -0000 2.145
@@ -1,6 +1,6 @@
# Vend::Config - Configure Interchange
#
-# $Id: Config.pm,v 2.144 2004/07/21 05:46:55 mheins Exp $
+# $Id: Config.pm,v 2.145 2004/10/07 00:10:01 jon Exp $
#
# Copyright (C) 2002-2003 Interchange Development Group
# Copyright (C) 1996-2002 Red Hat, Inc.
@@ -48,7 +48,7 @@
use Vend::File;
use Vend::Data;
-$VERSION = substr(q$Revision: 2.144 $, 10);
+$VERSION = substr(q$Revision: 2.145 $, 10);
my %CDname;
my %CPname;
@@ -3075,6 +3075,7 @@
ALTERNATE_LDAP_HOST ALTERNATE_LDAP_HOST
ALTERNATE_BIND_DN ALTERNATE_BIND_DN
ALTERNATE_BIND_PW ALTERNATE_BIND_PW
+ POSTEXPORT POSTEXPORT
! );
sub parse_config_db {
More information about the interchange-cvs
mailing list