I could use some assistance with a problem I've not been able to solve. I
created a perl script that will add a user to ldap using an ldif file. From
the command line it works no problem but if I add it to the end of another
working perl script I get errors and it does not work. The script I'm using
is;
#!/usr/bin/perl -w
use Net::LDAP;
use Net::LDAP::LDIF;
$user = $ARGV[0];
$server = "ldap.host.com";
$port = "389";
$rootdn = "uid=privuser,ou=Special Users,dc=ldap,dc=com";
$pw = "password";
$LDIFfile = "/root/ldap/ldif/$user.ldif";
$ldif = new Net::LDAP::LDIF($LDIFfile,"r");
@entries = $ldif->read();
$c = new Net::LDAP($server, port => $port) or
die "Unable to connect to $server: $@\n";
$c->bind(dn => $rootdn, password => $pw) or die "Error in bind: $@\n";
for (@entries){
$res = $c->add($_);
warn "Error in add for ". $_->dn().": error code ".$res->code."\n"
if $res->code();
}
print "The error message is: ".$res->error."\n";
$c->unbind();
The error is;
Can't call method "error" on an undefined value at
/root/ldap/bin/addldif2ldap.pl line 25. ****line 25 is the print "The error
message is:" from above script***
the command I append to the end of the working script is
system "/root/ldap/bin/addldif2ldap.pl $username";
Any help anyone can offer would be appreciated.
thanks,
William Skinner
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]