aboutsummaryrefslogtreecommitdiff
path: root/perl
diff options
context:
space:
mode:
authorRuss Allbery <eagle@eyrie.org>2014-07-11 22:36:11 -0700
committerRuss Allbery <rra@stanford.edu>2014-07-11 22:39:23 -0700
commit1329e6db944a6fce5578b249de08a8250a920877 (patch)
tree2dd24e191af3767a93a21db9cd6b183164dbe491 /perl
parentbf513da9cc1bc6f125aded53685cf71083c5ae56 (diff)
Test for Perl strict and minimum version
Fix strictness issues across the whole code base, and ensure that all Perl scripts enable warnings. (Hopefully enabling warnings won't cause problems for the server.) Change-Id: I4dee49f7a6bcbeeee21d74bf61a1fd26514f832c Reviewed-on: https://gerrit.stanford.edu/1532 Reviewed-by: Russ Allbery <rra@stanford.edu> Tested-by: Russ Allbery <rra@stanford.edu>
Diffstat (limited to 'perl')
-rw-r--r--perl/lib/Wallet/ACL.pm3
-rw-r--r--perl/lib/Wallet/ACL/Base.pm3
-rw-r--r--perl/lib/Wallet/ACL/Krb5.pm3
-rw-r--r--perl/lib/Wallet/ACL/Krb5/Regex.pm3
-rw-r--r--perl/lib/Wallet/ACL/LDAP/Attribute.pm3
-rw-r--r--perl/lib/Wallet/ACL/NetDB.pm3
-rw-r--r--perl/lib/Wallet/ACL/NetDB/Root.pm3
-rw-r--r--perl/lib/Wallet/Admin.pm3
-rw-r--r--perl/lib/Wallet/Config.pm1
-rw-r--r--perl/lib/Wallet/Database.pm3
-rw-r--r--perl/lib/Wallet/Kadmin.pm3
-rw-r--r--perl/lib/Wallet/Kadmin/Heimdal.pm1
-rw-r--r--perl/lib/Wallet/Kadmin/MIT.pm3
-rw-r--r--perl/lib/Wallet/Object/Base.pm3
-rw-r--r--perl/lib/Wallet/Object/Duo.pm1
-rw-r--r--perl/lib/Wallet/Object/File.pm3
-rw-r--r--perl/lib/Wallet/Object/Keytab.pm3
-rw-r--r--perl/lib/Wallet/Object/WAKeyring.pm3
-rw-r--r--perl/lib/Wallet/Report.pm3
-rw-r--r--perl/lib/Wallet/Server.pm3
-rw-r--r--perl/t/data/perl.conf7
-rwxr-xr-xperl/t/general/acl.t5
-rwxr-xr-xperl/t/general/admin.t7
-rwxr-xr-xperl/t/general/config.t7
-rwxr-xr-xperl/t/general/init.t5
-rwxr-xr-xperl/t/general/report.t7
-rwxr-xr-xperl/t/general/server.t7
-rw-r--r--perl/t/lib/Util.pm3
-rwxr-xr-xperl/t/object/base.t5
-rwxr-xr-xperl/t/object/file.t7
-rwxr-xr-xperl/t/object/keytab.t11
-rwxr-xr-xperl/t/style/minimum-version.t47
-rwxr-xr-xperl/t/style/strict.t56
-rwxr-xr-xperl/t/util/kadmin.t7
-rwxr-xr-xperl/t/verifier/basic.t5
-rwxr-xr-xperl/t/verifier/ldap-attr.t5
-rwxr-xr-xperl/t/verifier/netdb.t7
37 files changed, 211 insertions, 41 deletions
diff --git a/perl/lib/Wallet/ACL.pm b/perl/lib/Wallet/ACL.pm
index 808be3c..9507c64 100644
--- a/perl/lib/Wallet/ACL.pm
+++ b/perl/lib/Wallet/ACL.pm
@@ -1,7 +1,7 @@
# Wallet::ACL -- Implementation of ACLs in the wallet system.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2007, 2008, 2010, 2013
+# Copyright 2007, 2008, 2010, 2013, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::ACL;
require 5.006;
use strict;
+use warnings;
use vars qw($VERSION);
use DBI;
diff --git a/perl/lib/Wallet/ACL/Base.pm b/perl/lib/Wallet/ACL/Base.pm
index b6e4ce3..a2b07cc 100644
--- a/perl/lib/Wallet/ACL/Base.pm
+++ b/perl/lib/Wallet/ACL/Base.pm
@@ -1,7 +1,7 @@
# Wallet::ACL::Base -- Parent class for wallet ACL verifiers.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2007, 2010
+# Copyright 2007, 2010, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::ACL::Base;
require 5.006;
use strict;
+use warnings;
use vars qw($VERSION);
# This version should be increased on any code change to this module. Always
diff --git a/perl/lib/Wallet/ACL/Krb5.pm b/perl/lib/Wallet/ACL/Krb5.pm
index ed0b7df..80d32bd 100644
--- a/perl/lib/Wallet/ACL/Krb5.pm
+++ b/perl/lib/Wallet/ACL/Krb5.pm
@@ -1,7 +1,7 @@
# Wallet::ACL::Krb5 -- Wallet Kerberos v5 principal ACL verifier.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2007, 2010
+# Copyright 2007, 2010, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::ACL::Krb5;
require 5.006;
use strict;
+use warnings;
use vars qw(@ISA $VERSION);
use Wallet::ACL::Base;
diff --git a/perl/lib/Wallet/ACL/Krb5/Regex.pm b/perl/lib/Wallet/ACL/Krb5/Regex.pm
index 30f5527..4934cfc 100644
--- a/perl/lib/Wallet/ACL/Krb5/Regex.pm
+++ b/perl/lib/Wallet/ACL/Krb5/Regex.pm
@@ -1,7 +1,7 @@
# Wallet::ACL::Krb5::Regex -- Wallet Kerberos v5 principal regex ACL verifier
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2007, 2010
+# Copyright 2007, 2010, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::ACL::Krb5::Regex;
require 5.006;
use strict;
+use warnings;
use vars qw(@ISA $VERSION);
use Wallet::ACL::Krb5;
diff --git a/perl/lib/Wallet/ACL/LDAP/Attribute.pm b/perl/lib/Wallet/ACL/LDAP/Attribute.pm
index aea8a72..c27729e 100644
--- a/perl/lib/Wallet/ACL/LDAP/Attribute.pm
+++ b/perl/lib/Wallet/ACL/LDAP/Attribute.pm
@@ -1,7 +1,7 @@
# Wallet::ACL::LDAP::Attribute -- Wallet LDAP attribute ACL verifier.
#
# Written by Russ Allbery
-# Copyright 2012, 2013
+# Copyright 2012, 2013, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::ACL::LDAP::Attribute;
require 5.006;
use strict;
+use warnings;
use vars qw(@ISA $VERSION);
use Authen::SASL ();
diff --git a/perl/lib/Wallet/ACL/NetDB.pm b/perl/lib/Wallet/ACL/NetDB.pm
index b76d4ed..ad2164b 100644
--- a/perl/lib/Wallet/ACL/NetDB.pm
+++ b/perl/lib/Wallet/ACL/NetDB.pm
@@ -1,7 +1,7 @@
# Wallet::ACL::NetDB -- Wallet NetDB role ACL verifier.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2007, 2010
+# Copyright 2007, 2010, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::ACL::NetDB;
require 5.006;
use strict;
+use warnings;
use vars qw(@ISA $VERSION);
use Wallet::ACL::Base;
diff --git a/perl/lib/Wallet/ACL/NetDB/Root.pm b/perl/lib/Wallet/ACL/NetDB/Root.pm
index 6c95c6e..34163e7 100644
--- a/perl/lib/Wallet/ACL/NetDB/Root.pm
+++ b/perl/lib/Wallet/ACL/NetDB/Root.pm
@@ -1,7 +1,7 @@
# Wallet::ACL::NetDB::Root -- Wallet NetDB role ACL verifier (root instances).
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2007, 2010
+# Copyright 2007, 2010, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::ACL::NetDB::Root;
require 5.006;
use strict;
+use warnings;
use vars qw(@ISA $VERSION);
use Wallet::ACL::NetDB;
diff --git a/perl/lib/Wallet/Admin.pm b/perl/lib/Wallet/Admin.pm
index 3a05284..d39c272 100644
--- a/perl/lib/Wallet/Admin.pm
+++ b/perl/lib/Wallet/Admin.pm
@@ -1,7 +1,7 @@
# Wallet::Admin -- Wallet system administrative interface.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2008, 2009, 2010, 2011, 2012, 2013
+# Copyright 2008, 2009, 2010, 2011, 2012, 2013, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::Admin;
require 5.006;
use strict;
+use warnings;
use vars qw($VERSION);
use Wallet::ACL;
diff --git a/perl/lib/Wallet/Config.pm b/perl/lib/Wallet/Config.pm
index 5b0ab1c..527658c 100644
--- a/perl/lib/Wallet/Config.pm
+++ b/perl/lib/Wallet/Config.pm
@@ -10,6 +10,7 @@ package Wallet::Config;
require 5.006;
use strict;
+use warnings;
use vars qw($PATH $VERSION);
# This version should be increased on any code change to this module. Always
diff --git a/perl/lib/Wallet/Database.pm b/perl/lib/Wallet/Database.pm
index 031be9e..3a4e130 100644
--- a/perl/lib/Wallet/Database.pm
+++ b/perl/lib/Wallet/Database.pm
@@ -6,7 +6,7 @@
# like DBIx::Class objects in the rest of the code.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2008, 2009, 2010, 2012, 2013
+# Copyright 2008, 2009, 2010, 2012, 2013, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -19,6 +19,7 @@ package Wallet::Database;
require 5.006;
use strict;
+use warnings;
use vars qw(@ISA $VERSION);
use Wallet::Schema;
diff --git a/perl/lib/Wallet/Kadmin.pm b/perl/lib/Wallet/Kadmin.pm
index 4ea7920..65a5700 100644
--- a/perl/lib/Wallet/Kadmin.pm
+++ b/perl/lib/Wallet/Kadmin.pm
@@ -1,7 +1,7 @@
# Wallet::Kadmin -- Kerberos administration API for wallet keytab backend.
#
# Written by Jon Robertson <jonrober@stanford.edu>
-# Copyright 2009, 2010
+# Copyright 2009, 2010, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::Kadmin;
require 5.006;
use strict;
+use warnings;
use vars qw($VERSION);
use Wallet::Config ();
diff --git a/perl/lib/Wallet/Kadmin/Heimdal.pm b/perl/lib/Wallet/Kadmin/Heimdal.pm
index 42de8e0..1208801 100644
--- a/perl/lib/Wallet/Kadmin/Heimdal.pm
+++ b/perl/lib/Wallet/Kadmin/Heimdal.pm
@@ -14,6 +14,7 @@ package Wallet::Kadmin::Heimdal;
require 5.006;
use strict;
+use warnings;
use vars qw(@ISA $VERSION);
use Heimdal::Kadm5 qw(KRB5_KDB_DISALLOW_ALL_TIX);
diff --git a/perl/lib/Wallet/Kadmin/MIT.pm b/perl/lib/Wallet/Kadmin/MIT.pm
index 1ae01bf..ac45265 100644
--- a/perl/lib/Wallet/Kadmin/MIT.pm
+++ b/perl/lib/Wallet/Kadmin/MIT.pm
@@ -2,7 +2,7 @@
#
# Written by Russ Allbery <eagle@eyrie.org>
# Pulled into a module by Jon Robertson <jonrober@stanford.edu>
-# Copyright 2007, 2008, 2009, 2010
+# Copyright 2007, 2008, 2009, 2010, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -15,6 +15,7 @@ package Wallet::Kadmin::MIT;
require 5.006;
use strict;
+use warnings;
use vars qw(@ISA $VERSION);
use Wallet::Config ();
diff --git a/perl/lib/Wallet/Object/Base.pm b/perl/lib/Wallet/Object/Base.pm
index 8debac9..a009d76 100644
--- a/perl/lib/Wallet/Object/Base.pm
+++ b/perl/lib/Wallet/Object/Base.pm
@@ -1,7 +1,7 @@
# Wallet::Object::Base -- Parent class for any object stored in the wallet.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2007, 2008, 2010, 2011
+# Copyright 2007, 2008, 2010, 2011, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::Object::Base;
require 5.006;
use strict;
+use warnings;
use vars qw($VERSION);
use DBI;
diff --git a/perl/lib/Wallet/Object/Duo.pm b/perl/lib/Wallet/Object/Duo.pm
index e5773c8..e3fe2da 100644
--- a/perl/lib/Wallet/Object/Duo.pm
+++ b/perl/lib/Wallet/Object/Duo.pm
@@ -14,6 +14,7 @@ package Wallet::Object::Duo;
require 5.006;
use strict;
+use warnings;
use vars qw(@ISA $VERSION);
use JSON;
diff --git a/perl/lib/Wallet/Object/File.pm b/perl/lib/Wallet/Object/File.pm
index 4afef04..1ff1288 100644
--- a/perl/lib/Wallet/Object/File.pm
+++ b/perl/lib/Wallet/Object/File.pm
@@ -1,7 +1,7 @@
# Wallet::Object::File -- File object implementation for the wallet.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2008, 2010
+# Copyright 2008, 2010, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::Object::File;
require 5.006;
use strict;
+use warnings;
use vars qw(@ISA $VERSION);
use Digest::MD5 qw(md5_hex);
diff --git a/perl/lib/Wallet/Object/Keytab.pm b/perl/lib/Wallet/Object/Keytab.pm
index 24c3302..975179b 100644
--- a/perl/lib/Wallet/Object/Keytab.pm
+++ b/perl/lib/Wallet/Object/Keytab.pm
@@ -1,7 +1,7 @@
# Wallet::Object::Keytab -- Keytab object implementation for the wallet.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2007, 2008, 2009, 2010, 2013
+# Copyright 2007, 2008, 2009, 2010, 2013, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::Object::Keytab;
require 5.006;
use strict;
+use warnings;
use vars qw(@ISA $VERSION);
use Wallet::Config ();
diff --git a/perl/lib/Wallet/Object/WAKeyring.pm b/perl/lib/Wallet/Object/WAKeyring.pm
index f8bd0f7..3e80300 100644
--- a/perl/lib/Wallet/Object/WAKeyring.pm
+++ b/perl/lib/Wallet/Object/WAKeyring.pm
@@ -1,7 +1,7 @@
# Wallet::Object::WAKeyring -- WebAuth keyring object implementation.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2012, 2013
+# Copyright 2012, 2013, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::Object::WAKeyring;
require 5.006;
use strict;
+use warnings;
use vars qw(@ISA $VERSION);
use Digest::MD5 qw(md5_hex);
diff --git a/perl/lib/Wallet/Report.pm b/perl/lib/Wallet/Report.pm
index 1085546..bf48308 100644
--- a/perl/lib/Wallet/Report.pm
+++ b/perl/lib/Wallet/Report.pm
@@ -1,7 +1,7 @@
# Wallet::Report -- Wallet system reporting interface.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2008, 2009, 2010, 2013
+# Copyright 2008, 2009, 2010, 2013, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::Report;
require 5.006;
use strict;
+use warnings;
use vars qw($VERSION);
use Wallet::ACL;
diff --git a/perl/lib/Wallet/Server.pm b/perl/lib/Wallet/Server.pm
index 3266928..2765d34 100644
--- a/perl/lib/Wallet/Server.pm
+++ b/perl/lib/Wallet/Server.pm
@@ -1,7 +1,7 @@
# Wallet::Server -- Wallet system server implementation.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2007, 2008, 2010, 2011, 2013
+# Copyright 2007, 2008, 2010, 2011, 2013, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -14,6 +14,7 @@ package Wallet::Server;
require 5.006;
use strict;
+use warnings;
use vars qw(%MAPPING $VERSION);
use Wallet::ACL;
diff --git a/perl/t/data/perl.conf b/perl/t/data/perl.conf
new file mode 100644
index 0000000..ca05568
--- /dev/null
+++ b/perl/t/data/perl.conf
@@ -0,0 +1,7 @@
+# Configuration for Perl tests. -*- perl -*-
+
+# Default minimum version requirement.
+$MINIMUM_VERSION = '5.008';
+
+# File must end with this line.
+1;
diff --git a/perl/t/general/acl.t b/perl/t/general/acl.t
index e633f46..01b4801 100755
--- a/perl/t/general/acl.t
+++ b/perl/t/general/acl.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Tests for the wallet ACL API.
#
@@ -8,6 +8,9 @@
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
use POSIX qw(strftime);
use Test::More tests => 101;
diff --git a/perl/t/general/admin.t b/perl/t/general/admin.t
index 41bc33a..7c62932 100755
--- a/perl/t/general/admin.t
+++ b/perl/t/general/admin.t
@@ -8,6 +8,9 @@
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
use Test::More tests => 26;
use Wallet::Admin;
@@ -44,7 +47,7 @@ is ($admin->register_object ('base', 'Wallet::Object::Base'), 1,
'Registering Wallet::Object::Base works');
is ($admin->register_object ('base', 'Wallet::Object::Base'), undef,
' and cannot be registered twice');
-$server = eval { Wallet::Server->new ('admin@EXAMPLE.COM', 'localhost') };
+my $server = eval { Wallet::Server->new ('admin@EXAMPLE.COM', 'localhost') };
is ($@, '', 'Creating a server instance did not die');
is ($server->create ('base', 'service/admin'), 1,
' and creating base:service/admin succeeds');
@@ -83,7 +86,7 @@ SKIP: {
is ($retval, 1, ' and performing an upgrade to 0.08 succeeds');
my $sql = "select version from dbix_class_schema_versions order by"
. " version DESC";
- $version = $admin->dbh->selectall_arrayref ($sql);
+ my $version = $admin->dbh->selectall_arrayref ($sql);
is (@$version, 2, ' and versions table has correct number of rows');
is (@{ $version->[0] }, 1, ' and correct number of columns');
is ($version->[0][0], '0.08', ' and the schema version is correct');
diff --git a/perl/t/general/config.t b/perl/t/general/config.t
index 881f2bd..bc200de 100755
--- a/perl/t/general/config.t
+++ b/perl/t/general/config.t
@@ -1,13 +1,16 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Tests for the wallet server configuration.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2008, 2010
+# Copyright 2008, 2010, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
use Test::More tests => 6;
# Silence warnings since we're not using use.
diff --git a/perl/t/general/init.t b/perl/t/general/init.t
index b8ec3c9..58b9a4c 100755
--- a/perl/t/general/init.t
+++ b/perl/t/general/init.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Tests for database initialization.
#
@@ -8,6 +8,9 @@
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
use Test::More tests => 18;
use Wallet::ACL;
diff --git a/perl/t/general/report.t b/perl/t/general/report.t
index 9563362..8d348ed 100755
--- a/perl/t/general/report.t
+++ b/perl/t/general/report.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Tests for the wallet reporting interface.
#
@@ -8,6 +8,9 @@
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
use Test::More tests => 197;
use Wallet::Admin;
@@ -39,7 +42,7 @@ is ($acls[0][0], 1, ' and that is ACL ID 1');
is ($acls[0][1], 'ADMIN', ' with the right name');
# Create an object.
-$server = eval { Wallet::Server->new ('admin@EXAMPLE.COM', 'localhost') };
+my $server = eval { Wallet::Server->new ('admin@EXAMPLE.COM', 'localhost') };
is ($@, '', 'Creating a server instance did not die');
is ($server->create ('base', 'service/admin'), 1,
' and creating base:service/admin succeeds');
diff --git a/perl/t/general/server.t b/perl/t/general/server.t
index 9026439..0a527a5 100755
--- a/perl/t/general/server.t
+++ b/perl/t/general/server.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Tests for the wallet server API.
#
@@ -8,6 +8,9 @@
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
use Test::More tests => 382;
use POSIX qw(strftime);
@@ -33,7 +36,7 @@ is ($@, '', 'Database initialization did not die');
is ($setup->reinitialize ($admin), 1, 'Database initialization succeeded');
# Now test the new method.
-$server = eval { Wallet::Server->new (@trace) };
+my $server = eval { Wallet::Server->new (@trace) };
is ($@, '', 'Reopening with new did not die');
ok ($server->isa ('Wallet::Server'), ' and returned the right class');
my $schema = $server->schema;
diff --git a/perl/t/lib/Util.pm b/perl/t/lib/Util.pm
index 9e5b95e..187e483 100644
--- a/perl/t/lib/Util.pm
+++ b/perl/t/lib/Util.pm
@@ -1,7 +1,7 @@
# Utility class for wallet tests.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2007, 2008
+# Copyright 2007, 2008, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
@@ -10,6 +10,7 @@ package Util;
require 5.006;
use strict;
+use warnings;
use vars qw(@ISA @EXPORT $VERSION);
use Wallet::Config;
diff --git a/perl/t/object/base.t b/perl/t/object/base.t
index 0432a23..11f18b7 100755
--- a/perl/t/object/base.t
+++ b/perl/t/object/base.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Tests for the basic object implementation.
#
@@ -8,6 +8,9 @@
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
use POSIX qw(strftime);
use Test::More tests => 137;
diff --git a/perl/t/object/file.t b/perl/t/object/file.t
index 0aecd9d..201f46d 100755
--- a/perl/t/object/file.t
+++ b/perl/t/object/file.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Tests for the file object implementation.
#
@@ -8,6 +8,9 @@
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
use POSIX qw(strftime);
use Test::More tests => 56;
@@ -39,7 +42,7 @@ my $history = '';
my $date = strftime ('%Y-%m-%d %H:%M:%S', localtime $trace[2]);
# Test error handling in the absence of configuration.
-$object = eval {
+my $object = eval {
Wallet::Object::File->create ('file', 'test', $schema, @trace)
};
ok (defined ($object), 'Creating a basic file object succeeds');
diff --git a/perl/t/object/keytab.t b/perl/t/object/keytab.t
index 127762a..0f4a8b8 100755
--- a/perl/t/object/keytab.t
+++ b/perl/t/object/keytab.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Tests for the keytab object implementation.
#
@@ -8,6 +8,9 @@
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
use POSIX qw(strftime);
use Test::More tests => 141;
@@ -117,7 +120,7 @@ sub enctypes {
next unless /^ *\d+ /;
my ($string) = /\((.*)\)\s*$/;
next unless $string;
- $enctype = $enctype{lc $string} || 'UNKNOWN';
+ my $enctype = $enctype{lc $string} || 'UNKNOWN';
push (@enctypes, $enctype);
}
close KLIST;
@@ -174,7 +177,7 @@ SKIP: {
# Test that object creation without KEYTAB_TMP fails.
undef $Wallet::Config::KEYTAB_TMP;
- $object = eval {
+ my $object = eval {
Wallet::Object::Keytab->create ('keytab', 'wallet/one', $schema,
@trace)
};
@@ -634,7 +637,7 @@ EOO
is ("@values", "@enctypes", ' and we get back the right enctype list');
my $eshow = join ("\n" . (' ' x 17), @enctypes);
$eshow =~ s/\s+\z/\n/;
- $expected = <<"EOO";
+ my $expected = <<"EOO";
Type: keytab
Name: wallet/one
Enctypes: $eshow
diff --git a/perl/t/style/minimum-version.t b/perl/t/style/minimum-version.t
new file mode 100755
index 0000000..e4eeafd
--- /dev/null
+++ b/perl/t/style/minimum-version.t
@@ -0,0 +1,47 @@
+#!/usr/bin/perl
+#
+# Check that too-new features of Perl are not being used.
+#
+# The canonical version of this file is maintained in the rra-c-util package,
+# which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+#
+# Written by Russ Allbery <eagle@eyrie.org>
+# Copyright 2013, 2014
+# The Board of Trustees of the Leland Stanford Junior University
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+use 5.006;
+use strict;
+use warnings;
+
+use lib 't/lib';
+
+use Test::More;
+use Test::RRA qw(skip_unless_automated use_prereq);
+use Test::RRA::Config qw($MINIMUM_VERSION);
+
+# Skip for normal user installs since this doesn't affect functionality.
+skip_unless_automated('Minimum version tests');
+
+# Load prerequisite modules.
+use_prereq('Test::MinimumVersion');
+
+# Check all files in the Perl distribution.
+all_minimum_version_ok($MINIMUM_VERSION);
diff --git a/perl/t/style/strict.t b/perl/t/style/strict.t
new file mode 100755
index 0000000..7137b15
--- /dev/null
+++ b/perl/t/style/strict.t
@@ -0,0 +1,56 @@
+#!/usr/bin/perl
+#
+# Test Perl code for strict, warnings, and syntax.
+#
+# The canonical version of this file is maintained in the rra-c-util package,
+# which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+#
+# Written by Russ Allbery <eagle@eyrie.org>
+# Copyright 2013, 2014
+# The Board of Trustees of the Leland Stanford Junior University
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+use 5.006;
+use strict;
+use warnings;
+
+use lib 't/lib';
+
+use File::Spec;
+use Test::RRA qw(skip_unless_automated use_prereq);
+
+# Skip for normal user installs since this doesn't affect functionality.
+skip_unless_automated('Strictness tests');
+
+# Load prerequisite modules.
+use_prereq('Test::Strict');
+
+# Test everything in the distribution directory except the Build and
+# Makefile.PL scripts generated by Module::Build. We also want to check use
+# warnings.
+$Test::Strict::TEST_SKIP = ['Build', 'Makefile.PL'];
+$Test::Strict::TEST_WARNINGS = 1;
+all_perl_files_ok(File::Spec->curdir);
+
+# Hack to suppress "used only once" warnings.
+END {
+ $Test::Strict::TEST_SKIP = [];
+ $Test::Strict::TEST_WARNINGS = 0;
+}
diff --git a/perl/t/util/kadmin.t b/perl/t/util/kadmin.t
index 8eabc6b..2a3d984 100755
--- a/perl/t/util/kadmin.t
+++ b/perl/t/util/kadmin.t
@@ -1,13 +1,16 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Tests for the kadmin object implementation.
#
# Written by Jon Robertson <jonrober@stanford.edu>
-# Copyright 2009, 2010, 2012, 2013
+# Copyright 2009, 2010, 2012, 2013, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
use POSIX qw(strftime);
use Test::More tests => 34;
diff --git a/perl/t/verifier/basic.t b/perl/t/verifier/basic.t
index 5697ae6..ce44d44 100755
--- a/perl/t/verifier/basic.t
+++ b/perl/t/verifier/basic.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Tests for the basic wallet ACL verifiers.
#
@@ -8,6 +8,9 @@
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
use Test::More tests => 57;
use Wallet::ACL::Base;
diff --git a/perl/t/verifier/ldap-attr.t b/perl/t/verifier/ldap-attr.t
index d8e416b..3c132e2 100755
--- a/perl/t/verifier/ldap-attr.t
+++ b/perl/t/verifier/ldap-attr.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Tests for the LDAP attribute ACL verifier.
#
@@ -11,6 +11,9 @@
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
use Test::More;
use lib 't/lib';
diff --git a/perl/t/verifier/netdb.t b/perl/t/verifier/netdb.t
index d8fe561..7048ef9 100755
--- a/perl/t/verifier/netdb.t
+++ b/perl/t/verifier/netdb.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Tests for the NetDB wallet ACL verifiers.
#
@@ -12,6 +12,9 @@
#
# See LICENSE for licensing terms.
+use strict;
+use warnings;
+
use Test::More tests => 5;
use Wallet::ACL::NetDB;
@@ -35,7 +38,7 @@ SKIP: {
$Wallet::Config::NETDB_REMCTL_HOST = $netdb;
# Finally, we can test.
- $verifier = eval { Wallet::ACL::NetDB->new };
+ my $verifier = eval { Wallet::ACL::NetDB->new };
ok (defined $verifier, ' and now creation succeeds');
is ($@, q{}, ' with no errors');
ok ($verifier->isa ('Wallet::ACL::NetDB'), ' and returns the right class');