in reply to Re: How to compare two subroutine return values, to trigger email
in thread How to compare two subroutine return values, to trigger email
Suppose the return result from subroutine query_LDAP and query_AD should be compared,but here the comparison not working.
i have no idea what is wrong here, please advice dear monks..
i have provided my source codes here, please assist..
sub query_LDAP { $ldap = Net::LDAP->new( 'hostname' ); $mesg = $ldap->bind( 'uid=username,ou=xxxx,o=bbb', password => 'secret' ); $result = $ldap->modify( "uid=username,ou=xxxx,o=bbb", replace => {"name" => "star wars"} ); $result->code && warn "failed to add entry: ", $result->error ; $result = $ldap->search ( base => "ou=xxxx,o=bbb", filter => "uid=username" ) or die ("Failed on search.$!"); foreach my $entry ($result->entries) { my $LDAP_name= $entry->get_value( "name" ); print "Query Result from LDAP : ",$LDAP_name,"\n";} $mesg= $ldap->unbind;} # take down session sub query_AD { $ldap = Net::LDAP->new('hostname') or die "$0"; $mesg = $ldap->bind( 'cn=username,ou=somecontainer,DC=com', password => 'secret'); $result = $ldap->search(base => "ou=somecontainer,DC=com", filter=> "cn=username" ) or die ("Failed on search.$!"); foreach my $entry ($result->entries){ my $AD_name= $entry->get_value( "name" ); print "Query Result from AD : ",$AD_name,"\n";} $mesg= $ldap->unbind;} # take down session if (query_LDAP() ne query_AD()) { print "not identical!!!!\n";} else{ print "its the same\n";}
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: How to compare two subroutine return values, to trigger email
by brap (Pilgrim) on Sep 20, 2012 at 12:45 UTC |
In Section
Seekers of Perl Wisdom