diff --git a/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/SAML/Metadata.pm b/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/SAML/Metadata.pm index b549e27cd..ffc62af13 100644 --- a/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/SAML/Metadata.pm +++ b/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/SAML/Metadata.pm @@ -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; } diff --git a/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Serializer.pm b/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Serializer.pm index da3525440..2fb6ffadf 100644 --- a/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Serializer.pm +++ b/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Serializer.pm @@ -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) ) { diff --git a/lemonldap-ng-common/lib/Lemonldap/NG/Common/Notification/LDAP.pm b/lemonldap-ng-common/lib/Lemonldap/NG/Common/Notification/LDAP.pm index 28fdbb3a3..6725103b2 100644 --- a/lemonldap-ng-common/lib/Lemonldap/NG/Common/Notification/LDAP.pm +++ b/lemonldap-ng-common/lib/Lemonldap/NG/Common/Notification/LDAP.pm @@ -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"; } diff --git a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Main.pm b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Main.pm index c4e78d88d..8f4ad6d6e 100755 --- a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Main.pm +++ b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Main.pm @@ -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"; } diff --git a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Reload.pm b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Reload.pm index 07afc419b..735fcab22 100755 --- a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Reload.pm +++ b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Reload.pm @@ -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} = diff --git a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Status.pm b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Status.pm index 581937aec..76c5cb6f5 100644 --- a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Status.pm +++ b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Status.pm @@ -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 diff --git a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/Parser.pm b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/Parser.pm index 6e5c76cda..11d9462ad 100644 --- a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/Parser.pm +++ b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/Parser.pm @@ -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->(); diff --git a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/Tests.pm b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/Tests.pm index 4e8b78a46..cd835e949 100644 --- a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/Tests.pm +++ b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/Tests.pm @@ -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; diff --git a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Sessions.pm b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Sessions.pm index f392f202a..47f0c9341 100644 --- a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Sessions.pm +++ b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Sessions.pm @@ -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} } }++; diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/AuthGoogle.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/AuthGoogle.pm index 2baf43110..4cb3bf202 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/AuthGoogle.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/AuthGoogle.pm @@ -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