Avoid using each(): it tries to delete key
This commit is contained in:
parent
b86a321aac
commit
8c1bd8efeb
|
@ -59,8 +59,8 @@ sub initializeFromConfHash {
|
|||
|
||||
return 0 unless $hash;
|
||||
|
||||
while ( my ( $k, $v ) = each(%$hash) ) {
|
||||
$self->{$k} = $v;
|
||||
foreach my $k ( keys %$hash ) {
|
||||
$self->{$k} = $hash->{$k};
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -98,8 +98,8 @@ sub initializeFromXML {
|
|||
|
||||
# Store data in Metadata object
|
||||
if ($data) {
|
||||
while ( my ( $k, $v ) = each( %{$data} ) ) {
|
||||
$self->{$k} = $v;
|
||||
foreach my $k ( keys %{$data} ) {
|
||||
$self->{$k} = $data->{$k};
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,8 @@ sub serialize {
|
|||
my $fields;
|
||||
|
||||
# Parse configuration
|
||||
while ( my ( $k, $v ) = each(%$conf) ) {
|
||||
foreach my $k (keys %$conf ) {
|
||||
my $v = $conf->{$k};
|
||||
|
||||
# 1.Hash ref
|
||||
if ( ref($v) ) {
|
||||
|
|
|
@ -302,8 +302,8 @@ sub _store {
|
|||
|
||||
# Store values as {key}value
|
||||
my @notifValues;
|
||||
while ( my ( $k, $v ) = each(%$fields) ) {
|
||||
$v = encodeLdapValue($v);
|
||||
foreach my $k ( keys %$fields ) {
|
||||
my $v = encodeLdapValue( $fields->{$k} );
|
||||
push @notifValues, "{$k}$v";
|
||||
}
|
||||
|
||||
|
|
|
@ -662,8 +662,8 @@ sub postJavascript {
|
|||
my $form = $formParams->{formSelector} || "form";
|
||||
|
||||
my $filler;
|
||||
while ( my ( $name, $value ) = each(%$data) ) {
|
||||
$value = "x" x length($value);
|
||||
foreach my $name ( keys %$data ) {
|
||||
my $value = "x" x length( $data->{$name} );
|
||||
$filler .=
|
||||
"form.find('input[name=$name], select[name=$name], textarea[name=$name]').val('$value')\n";
|
||||
}
|
||||
|
|
|
@ -172,7 +172,8 @@ sub portalInit {
|
|||
sub locationRulesInit {
|
||||
my ( $class, $conf, $tsv ) = @_;
|
||||
|
||||
while ( my ( $vhost, $rules ) = each( %{ $conf->{locationRules} } ) ) {
|
||||
foreach my $vhost ( keys %{ $conf->{locationRules} } ) {
|
||||
my $rules = $conf->{locationRules}->{$vhost};
|
||||
foreach my $url ( sort keys %{$rules} ) {
|
||||
my ( $cond, $prot ) = $class->conditionSub( $rules->{$url}, $tsv );
|
||||
|
||||
|
@ -271,7 +272,8 @@ sub postUrlInit {
|
|||
foreach my $vhost ( keys %{ $conf->{post} } ) {
|
||||
|
||||
# Browse all POST URI
|
||||
while ( my ( $url, $d ) = each( %{ $conf->{post}->{$vhost} } ) ) {
|
||||
foreach my $url ( keys %{ $conf->{post}->{$vhost} } ) {
|
||||
my $d = $conf->{post}->{$vhost}->{$url};
|
||||
Lemonldap::NG::Handler::Main::Logger->lmLog(
|
||||
"Compiling POST data for $url", 'debug' );
|
||||
|
||||
|
@ -281,8 +283,8 @@ sub postUrlInit {
|
|||
$postUrl ||= $url;
|
||||
|
||||
my $sub;
|
||||
while ( my ( $input, $value ) = each( %{ $d->{expr} } ) ) {
|
||||
my $val = $class->substitute($value);
|
||||
foreach my $input ( keys %{ $d->{expr} } ) {
|
||||
my $val = $class->substitute( $d->{expr}->{$input} );
|
||||
$sub .= "'$input' => $val,";
|
||||
}
|
||||
$tsv->{inputPostData}->{$vhost}->{$postUrl} =
|
||||
|
|
|
@ -174,7 +174,8 @@ sub run {
|
|||
&head;
|
||||
|
||||
my ( $c, $m, $u );
|
||||
while ( my ( $user, $v ) = each( %{ $status->{user} } ) ) {
|
||||
foreach my $user ( keys %{ $status->{user} } ) {
|
||||
my $v = $status->{user}->{$user};
|
||||
$u++ unless ( $user =~ /^\d+\.\d+\.\d+\.\d+$/ );
|
||||
|
||||
# Total requests
|
||||
|
|
|
@ -939,7 +939,8 @@ sub _globalTest {
|
|||
hdebug('# _globalTest()');
|
||||
my $result = 1;
|
||||
my $tests = &Lemonldap::NG::Manager::Conf::Tests::tests( $self->newConf );
|
||||
while ( my ( $name, $sub ) = each %$tests ) {
|
||||
foreach my $name ( keys %$tests ) {
|
||||
my $sub = $tests->{$name};
|
||||
my ( $res, $msg );
|
||||
eval {
|
||||
( $res, $msg ) = $sub->();
|
||||
|
|
|
@ -137,7 +137,8 @@ sub tests {
|
|||
checkUserDBGoogleAXParams => sub {
|
||||
my @tmp;
|
||||
if ( $conf->{userDB} =~ /^Google$/ ) {
|
||||
while ( my ( $k, $v ) = each %{ $conf->{exportedVars} } ) {
|
||||
foreach my $k ( keys %{ $conf->{exportedVars} } ) {
|
||||
my $v = $conf->{exportedVars}->{$k};
|
||||
if ( $v !~ Lemonldap::NG::Common::Regexp::GOOGLEAXATTR() ) {
|
||||
push @tmp, $v;
|
||||
}
|
||||
|
@ -159,7 +160,8 @@ sub tests {
|
|||
checkUserDBOpenIDParams => sub {
|
||||
my @tmp;
|
||||
if ( $conf->{userDB} =~ /^OpenID$/ ) {
|
||||
while ( my ( $k, $v ) = each %{ $conf->{exportedVars} } ) {
|
||||
foreach my $k ( keys %{ $conf->{exportedVars} } ) {
|
||||
my $v = $conf->{exportedVars}->{$k};
|
||||
if ( $v !~ Lemonldap::NG::Common::Regexp::OPENIDSREGATTR() )
|
||||
{
|
||||
push @tmp, $v;
|
||||
|
|
|
@ -165,7 +165,8 @@ sub sessions {
|
|||
my %r;
|
||||
|
||||
# 2.4.1 Store user IP addresses in %r
|
||||
while ( my ( $id, $entry ) = each %$res ) {
|
||||
foreach my $id ( keys %$res ) {
|
||||
my $entry = $res->{$id};
|
||||
next if ( $entry->{_httpSessionType} );
|
||||
$r{ $entry->{ $tsv->{whatToTrace} } }
|
||||
->{ $entry->{ $self->{ipField} } }++;
|
||||
|
|
|
@ -85,8 +85,8 @@ sub checkGoogleSession {
|
|||
unless ( $self->{_AXNS} ) {
|
||||
if ( $pSession->data ) {
|
||||
$self->{user} = $pSession->data->{email};
|
||||
while ( my ( $k, $v ) = each %{ $pSession->data } ) {
|
||||
$gs->{$k} = $v;
|
||||
foreach my $k ( keys %{ $pSession->data } ) {
|
||||
$gs->{$k} = $pSession->data->{$k};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ sub extractFormInfo {
|
|||
# b) if UserDB is Google, ask for exported variables
|
||||
if ( $self->get_module('user') eq 'Google' ) {
|
||||
my $u;
|
||||
while ( my ( $v, $k ) = each %{ $self->{exportedVars} } ) {
|
||||
foreach my $k ( values %{ $self->{exportedVars} } ) {
|
||||
next if ( $k eq 'email' );
|
||||
|
||||
# Check if wanted attribute is known by Google
|
||||
|
|
Loading…
Reference in New Issue
Block a user