Charles Colbourn wrote:
Hi all,

I've recently uploaded to CPAN Data::Sync - a utility module which may be
of interest to dbi & perl-ldap users. I've posted a thread on
www.perlmonks.org here:

http://www.perlmonks.org/?node_id=494094

asking for comments and suggestions, if anyone would like to take a look.
You can post feedback to the thread, on the cpanforum, or to the email
address listed in the perldocs.

Hi Charles,
That sure sounds handy. I imagined how I would like to use this tool, so I wrote my thoughts in perl. Let me know what you think.


$source_base = "dc=test,dc=org";
$target_base = "dc=foobar,dc=com";

$s->source($ldap,
           {
            filter => "(cn=*)",
            scope  => "sub",
            base   => "$source_base,
            attrs  => [ "*", "aci", "modifyTimeStamp" ],
           }
         );

#
# transform source objects to match target schema
#

$s->transforms(dn   => { newbase => $target_base },
               attr => { value   => "*",
                         regex   => "s/$source_base/$target_base/"
                       },
               attr => { value   => "myAttr21",
                         regex   => "s/foo/bar"
                       },
               attr => { name    => "attr1"
                         regex   => "s/attr1/attr3/"
                       },
               oc   => { value   => "*",
                         regex   => "s/foo/bar"
                       },
              );


#
# extend source objects to match target schema
#

$s->extends( filter    => "(objectClass=foo2)",
             add_ocs   => [ "myOC1", "myOC2" ],
             att_attrs => {
                           attr1 => "FIXME_LATER",
                           attr2 => "FIXME_LATER",
                           attr3 => "winchester",
                           attr4 => "mobile",
                          },
            );


#
# save rejects to file
#

$reject_file    = "rejects.ldif";
$s->rejects($reject_file);


 How does that look? :-)


BR,
Mike

Reply via email to