Greetings,
I would like to register the the module names below, unless you
think other names would be better (Maybe DBIx::* instead of Data:*?).
Name DSLI Description Info
------------- ---- -------------------------------------------- -----
Data::Syncer adpO Super class for Data::Syncer::* SCHOEN
Data::Syncer::LDAP adpO Synchronizing data in LDAP databases SCHOEN
Data::Syncer::SQL adpO Synchronizing data in SQL databases SCHOEN
Data::Syncer::LDAP uses (requires) Net::LDAP.
Data::Syncer::SQL uses (requires) DBD.
Sample code using my modules:
#!/usr/bin/perl -w
use strict;
use Data::Syncer::SQL;
use Data::Syncer::LDAP;
my $db=Data::Syncer::SQL -> new (
# HOW TO CONNECT
common => {
connect=>{source=>'dbi:Oracle:host=dream.capgemini.se;sid=ORCL',
user=>'SCOTT',password=>'TIGER'}, # connect to ORCL on dream
table => 'EMPMAIL', # table
keys => ['EMPNO'], # primary key is EMPNO
map => {
EMPNO=>'uid', # get EMPNO from uid
},
},
# WHAT TO MODIFY
modify => {
map => {
NAME=>{
fields=>['sn', 'givenName'], # get NAME from sn and givenName
function=>sub { # function to produce NAME from sn and givenName
my $sn=shift;
my $givenName=shift;
return "$sn, $givenName";
}
},
EMAIL=>'mail', # EMAIL from mail
},
},
# EXTRA RULES FOR ADDING NEW RECORDS TO TABLE
add => { } # no extra fields to update for new records
);
my $ldap=Data::Syncer::LDAP -> new (
# HOW TO CONNECT AND SEARCH IN LDAP
common => {
connect=>{
host=>'directory.capgemini.se',
dn=>'',
password=>''
},
base=>"o=Cap Gemini Europe,o=Cap Gemini Group",
keys=>['uid'], # uniqe id
attributes=>['sn', 'givenName', 'mail'], # attributes to read
filter=>'(&(objectClass=person)(c=SE))', # only swedish persons
},
);
# update database from ldap
$ldap->synchronize($db);
# schoen