Skip to Content.
Sympa Menu

devel - [sympa-dev] Re: Auth.pm

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: <address@concealed>
  • To: address@concealed
  • Subject: [sympa-dev] Re: Auth.pm
  • Date: Thu, 5 Apr 2007 01:17:44 +0200


I am looking at Auth.pm in sympa 5.2.4 and making some changes. I am puzzled
by the end of the get_email_by_net_id sub (I am also puzzled by its name since
it does more than what its name indicates). Anyway, at the end of the sub,
after doing an ldap search for email attributes:
....
my @results = $emails->entries;
foreach my $result (@results){
return (lc($result->get_value($ldap->{'ldap_email_attribute'})));
}

## return only the first attribute

my $entry = $emails->entry(0);
my @canonic_email =
$entry->get_value($ldap->{'ldap_email_attribute'},alloptions);
foreach my $email (@canonic_email){
return(lc($email));
}
}

}
....

It is puzzling that there are returns inside of foreach loops. I suppose that
works by an implicit skip of the return when the array is empty. However, if
the first return doesn't get used as a result of @results being empty, how
could the second return work? Can someone explain this to me?



Archive powered by MHonArc 2.6.19+.

Top of Page