Re: Net::LDAP::Intermediate::SyncInfo

Mathieu Parent <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.ldap
Message-ID <[email protected]>
Hi,


On Tue, Jul 7, 2009 at 6:05 PM, Dieter Kluenter<[email protected]> wrote:
> Hi,
> I want to set up perl based replication system. For this I just copied
> perldoc Net::LDAP::Intermediate::SyncInfo into my file, modified host
> name and search base. This script throws following error:
>
> dieter@rubin:> perl synctest.pl
> Can't call method "isa" on an undefined value at synctest.pl line 37, <DATA> line 872.
>        (in cleanup) Can't call method "isa" on an undefined value at synctest.pl line 37, <DATA> line 872.
>
> ,----[ script lines 32 - 38 ]
> | sub searchCallback {
> |   my $message = shift;
> |   my $entry = shift;
> |   my @controls = $message->control;
> |
> |   if($controls[0]->isa('Net::LDAP::Control::SyncState')) {
> |     print "Received Sync State Control\n";
> `----
>
> What is wrong with this script?
>

The search callback is also called when receiving intermediate
messages (without control).
You can replace the problematic line with:
if($controls[0] and $controls[0]->isa(...

The example included in the doc is very simple and doesn't cover all
cases. For a working example (refreshOnly) see "sub searchCallback()"
in module Kolab::LDAP::Backend::syncrepl in Kolab ([kolab-syncrepl]).
Also you can encounter some problems with rereshAndPersist mode.

I will propose a patch to update the doc.

Mathieu Parent

[kolab-syncrepl]:
http://kolab.org/cgi-bin/viewcvs-kolab.cgi/server/perl-kolab/lib/Kolab/LDAP/Backend/syncrepl.pm?rev=1.6&content-type=text/vnd.viewcvs-markup
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.