6 use FindBin (qw($Bin));
9 use LiCoM::Config (qw(get_config));
14 if (-e $ENV{'HOME'} . '/.licomrc')
16 $Config = get_config ($ENV{'HOME'} . '/.licomrc');
18 elsif (-e '/etc/licom/licom.conf')
20 $Config = get_config ('/etc/licom/licom.conf');
24 $Config = get_config ();
27 unless (defined ($Config->{'uri'}) and defined ($Config->{'bind_dn'})
28 and defined ($Config->{'password'}))
31 The configuration has not been found or is not complete. At least the options
32 uri, bind_dn and password are needed.
36 $Config->{'base_dn'} = $Config->{'bind_dn'} unless (defined ($Config->{'base_dn'}));
42 $temp =~ s/[^\.\*\w\s]//g;
47 push (@Patterns, [[lastname => $temp], [firstname => $temp], [mail => $temp]]);
50 die ('No (valid) patterns found.') unless (@Patterns);
52 LiCoM::Person->connect
54 uri => $Config->{'uri'},
55 base_dn => $Config->{'base_dn'},
56 bind_dn => $Config->{'bind_dn'},
57 password => $Config->{'password'}
60 our @Matches = LiCoM::Person->search (@Patterns, [[mail => '*']]);
62 print STDOUT scalar (@Matches), ' ', (scalar (@Matches) == 1 ? 'entry' : 'entries'), " found.\n";
67 my $cn = $person->name ();
68 my @mail = $person->get ('mail');
72 print "$_\t$cn\tFound by LiCoM\n";
76 LiCoM::Person->disconnect ();