Bug 6679 - fix 3 perlcritic violations in C4/Auth.pm, and enabled warnings
authorMason James <mtj@kohaaloha.com>
Tue, 26 Jun 2012 16:54:11 +0000 (04:54 +1200)
committerPaul Poulain <paul.poulain@biblibre.com>
Thu, 20 Sep 2012 10:18:14 +0000 (12:18 +0200)
Subroutine prototypes used at line 561, column 1.  See page 194 of PBP.  (Severity: 5)

Bareword file handle opened at line 606, column 5.  See pages 202,204 of PBP.  (Severity: 5)

Two-argument "open" used at line 606, column 5.  See page 207 of PBP.  (Severity: 5)

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
This patch reintroduces 'use warnings' in C4/Auth.pm.
Keep attentive to new warning messages in your log

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
C4/Auth.pm

index d4ad292..5486f76 100644 (file)
@@ -18,7 +18,7 @@ package C4::Auth;
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 use strict;
-#use warnings; FIXME - Bug 2505
+use warnings;
 use Digest::MD5 qw(md5_base64);
 use Storable qw(thaw freeze);
 use URI::Escape;
@@ -129,6 +129,7 @@ my $SEARCH_HISTORY_INSERT_SQL =<<EOQ;
 INSERT INTO search_history(userid, sessionid, query_desc, query_cgi, total, time            )
 VALUES                    (     ?,         ?,          ?,         ?,          ?, FROM_UNIXTIME(?))
 EOQ
+
 sub get_template_and_user {
     my $in       = shift;
     my $template =
@@ -546,7 +547,7 @@ has authenticated.
 
 =cut
 
-sub _version_check ($$) {
+sub _version_check {
     my $type = shift;
     my $query = shift;
     my $version;
@@ -591,9 +592,9 @@ sub _version_check ($$) {
 
 sub _session_log {
     (@_) or return 0;
-    open L, ">>/tmp/sessionlog" or warn "ERROR: Cannot append to /tmp/sessionlog";
-    printf L join("\n",@_);
-    close L;
+    open my $fh, '>>', "/tmp/sessionlog" or warn "ERROR: Cannot append to /tmp/sessionlog";
+    printf $fh join("\n",@_);
+    close $fh;
 }
 
 sub checkauth {