Tie::LDAP

Tie LDAP database to Perl hash
Download

Tie::LDAP Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Taisuke Yamada
  • Publisher web site:
  • http://search.cpan.org/~taiy/

Tie::LDAP Tags


Tie::LDAP Description

Tie LDAP database to Perl hash Tie::LDAP is a Perl module that allows you to tie LDAP database to Perl hash. Once tied, all hash operation will cause corresponding LDAP operation, as you would (probably) expect.Referencing tied hash will return hash reference to named LDAP entry that holds lowercased attribute as hash key, and reference to ARRAY containing data as hash value.Storing data is as easy as fetching: just push hash reference - with the same structure as fetched hash - back in.Also, fetching/storing data into fetched hash reference will work as expected - it will manipulate corresponding field in fetched LDAP entry.EXAMPLEHere's a brief example of how you can use this module: use Tie::LDAP; ## connect tie %LDAP, 'Tie::LDAP', { base => 'o=IMASY, c=JP' }; ## lookup entry for $info = $LDAP{q{cn=tai, o=IMASY, c=JP}}; ## lookup each attributes $user = $info->{username}->; $mail = @{$info->{mailaddr}}; ## update each attributes $info->{username} = ; $info->{mailaddr} = ; ## update entry $LDAP{q{cn=tai, o=IMASY, c=JP}} = { username => , mailaddr => , }; ## dump database (under base DN of ) in LDIF style while (my($dn, $hash) = each %LDAP) { print "dn: $dn\n"; while (my($name, $list) = each %{$hash}) { foreach (@{$list}) { print "$name: $_\n"; } } print "\n"; } ## disconnect untie %LDAP;SYNOPSIS use Tie::LDAP; tie %LDAP, 'Tie::LDAP', { host => $host, # LDAP hostname (defaults to 127.0.0.1) port => $port, # Port number (defaults to 389) user => $user, # Full DN used to access LDAP database pass => $pass, # Password used with above DN base => $base, # Base DN used for each/keys/values operation }; Requirements: · Perl


Tie::LDAP Related Software