Subject: Developers of Sympa
List archive
- From: Olivier Salaün - CRU <address@concealed>
- To: address@concealed
- Cc: address@concealed
- Subject: [sympa-dev] Re: Re: Auth.pm
- Date: Thu, 05 Apr 2007 09:44:19 +0200
You're right, there should be a single loop ; both code are equivalents. This second piece of code has actualy been removed from the current development version of Sympa , see http://sourcesup.cru.fr/cgi/viewvc.cgi/trunk/wwsympa/Auth.pm?revision=4189&root=sympa&view=markup
address@concealed wrote:
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?
-
[sympa-dev] Re: Auth.pm,
grimm26, 04/04/2007
- [sympa-dev] Re: Re: Auth.pm, Olivier Salaün - CRU, 04/05/2007
Archive powered by MHonArc 2.6.19+.