Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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";}

In reply to Re^2: How to compare two subroutine return values, to trigger email by anakin30
in thread How to compare two subroutine return values, to trigger email by anakin30

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-24 07:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found