From d940a656c8bfb178bd548492598cc445749fd53d Mon Sep 17 00:00:00 2001 From: Guillaume Rousse <guillaume.rousse@renater.fr> Date: Thu, 2 Nov 2017 11:21:56 +0100 Subject: [PATCH] use explicit variable names --- lib/IdPAccountManager/SAMLMetadata.pm | 15 ++++++++------- lib/IdPAccountManager/WebRequest.pm | 9 +++++---- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/IdPAccountManager/SAMLMetadata.pm b/lib/IdPAccountManager/SAMLMetadata.pm index 909e222..ffb7a84 100644 --- a/lib/IdPAccountManager/SAMLMetadata.pm +++ b/lib/IdPAccountManager/SAMLMetadata.pm @@ -7,6 +7,7 @@ package IdPAccountManager::SAMLMetadata; use strict; use warnings; +use English qw(-no_match_vars); use IdPAccountManager::Tools; use IdPAccountManager::Logger; @@ -45,7 +46,7 @@ sub load { $self->{logger}->log( level => LOG_ERROR, message => - "Failed to read $in{'federation_metadata_file_path'} : $!" + "Failed to read $in{'federation_metadata_file_path'} : $ERRNO" ); return undef; } @@ -55,7 +56,7 @@ sub load { { $self->{logger}->log( level => LOG_ERROR, - message => "Failed to parse file $in{'metadata_file'} : $!" + message => "Failed to parse file $in{'metadata_file'} : $ERRNO" ); return undef; } @@ -122,7 +123,7 @@ sub _get_xml_object { unless (-f $metadata_file) { $self->{logger}->log( level => LOG_ERROR, - message => "File $metadata_file not found: $!" + message => "File $metadata_file not found: $ERRNO" ); return undef; } @@ -130,7 +131,7 @@ sub _get_xml_object { unless (open FH, $metadata_file) { $self->{logger}->log( level => LOG_ERROR, - message => "Failed to open file $metadata_file: $!" + message => "Failed to open file $metadata_file: $ERRNO" ); return undef; } @@ -149,10 +150,10 @@ sub _get_xml_object { ## Eval() prevents the parsing from killing the main process eval { $doc = $parser->parse_fh(\*FH) }; - if ($@) { + if ($EVAL_ERROR) { $self->{logger}->log( level => LOG_ERROR, - message => "Failed to parse file $metadata_file : $@" + message => "Failed to parse file $metadata_file : $EVAL_ERROR" ); return undef; } @@ -160,7 +161,7 @@ sub _get_xml_object { unless ($doc) { $self->{logger}->log( level => LOG_ERROR, - message => "Failed to parse file $metadata_file : $!" + message => "Failed to parse file $metadata_file : $ERRNO" ); return undef; } diff --git a/lib/IdPAccountManager/WebRequest.pm b/lib/IdPAccountManager/WebRequest.pm index e6f41f0..0666cb9 100755 --- a/lib/IdPAccountManager/WebRequest.pm +++ b/lib/IdPAccountManager/WebRequest.pm @@ -3,6 +3,7 @@ package IdPAccountManager::WebRequest; use strict; use warnings; +use English qw(-no_match_vars); use IdPAccountManager::Logger; use Conf; @@ -221,7 +222,7 @@ sub req_account_wizard { push @{ $self->{'param_out'}{'errors'} }, "internal"; $self->{logger}->log( level => LOG_ERROR, - message => "Failed to load federation metadata : $!" + message => "Failed to load federation metadata : $ERRNO" ); return undef; } @@ -230,7 +231,7 @@ sub req_account_wizard { push @{ $self->{'param_out'}{'errors'} }, "internal"; $self->{logger}->log( level => LOG_ERROR, - message => "Failed to parse federation metadata : $!" + message => "Failed to parse federation metadata : $ERRNO" ); return undef; } @@ -268,7 +269,7 @@ sub req_select_sp { push @{ $self->{'param_out'}{'errors'} }, "internal"; $self->{logger}->log( level => LOG_ERROR, - message => "Failed to load federation metadata : $!" + message => "Failed to load federation metadata : $ERRNO" ); return undef; } @@ -282,7 +283,7 @@ sub req_select_sp { push @{ $self->{'param_out'}{'errors'} }, "internal"; $self->{logger}->log( level => LOG_ERROR, - message => "Failed to parse federation metadata : $!" + message => "Failed to parse federation metadata : $ERRNO" ); return undef; } -- GitLab