]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Rationalize ‘use’ order in Perl code.
authorZack Weinberg <zackw@panix.com>
Mon, 31 Aug 2020 15:23:00 +0000 (11:23 -0400)
committerZack Weinberg <zackw@panix.com>
Mon, 31 Aug 2020 17:15:45 +0000 (13:15 -0400)
All the Perl scripts and modules now ‘use’ other modules in the
following order:

 - use 5.006; use strict; use warnings; in that order.
   If a file was not already use-ing one of these three, it was added.

 - The BEGIN block that adds the installation directory for the
   Autom4te:: modules to @INC, if necessary.

 - All stdlib modules whose name begins with a capital letter,
   in ASCII sort order.

 - All Autom4te:: modules, in ASCII sort order.

 - ‘use vars qw (...)’, if any, last.

Also, ‘use foo qw (...)’ and @ISA lists have been sorted into ASCII
sort order.  (@EXPORT lists, which often follow immediately after @ISA
lists, have *not* been sorted, as these appear to have been organized
semantically in many cases.)  qw delimiters have been normalized to
round parentheses with a space between the qw and the open paren.

* bin/autoheader.in, bin/autom4te.in, bin/autoreconf.in
* bin/autoscan.in, bin/autoupdate.in, bin/ifnames.in
* lib/Autom4te/C4che.pm, lib/Autom4te/ChannelDefs.pm
* lib/Autom4te/Channels.pm, lib/Autom4te/Configure_ac.pm
* lib/Autom4te/FileUtils.pm, lib/Autom4te/General.pm
* lib/Autom4te/Getopt.pm, lib/Autom4te/Request.pm
* lib/Autom4te/XFile.pm: Rationalize order and format of ‘use’
  directives and @ISA lists.  Add any of ‘use 5.006’, ‘use strict’,
  and ‘use warnings’ that was not already present.

15 files changed:
bin/autoheader.in
bin/autom4te.in
bin/autoreconf.in
bin/autoscan.in
bin/autoupdate.in
bin/ifnames.in
lib/Autom4te/C4che.pm
lib/Autom4te/ChannelDefs.pm
lib/Autom4te/Channels.pm
lib/Autom4te/Configure_ac.pm
lib/Autom4te/FileUtils.pm
lib/Autom4te/General.pm
lib/Autom4te/Getopt.pm
lib/Autom4te/Request.pm
lib/Autom4te/XFile.pm

index 2a9a2e074f78bb12edef58e705eccb960c90512a..3068e2b0601626c7c337298e30a46fa7a895b54a 100644 (file)
@@ -26,6 +26,10 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
 # Written by Roland McGrath.
 # Rewritten in Perl by Akim Demaille.
 
+use 5.006;
+use strict;
+use warnings;
+
 BEGIN
 {
   my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
@@ -44,10 +48,9 @@ use Autom4te::Configure_ac;
 use Autom4te::FileUtils;
 use Autom4te::General;
 use Autom4te::XFile;
-use strict;
 
 # Using 'do FILE', we need 'local' vars.
-use vars qw ($config_h %verbatim %symbol);
+use vars qw ($config_h %symbol %verbatim);
 
 # Lib files.
 my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@';
index 0662767d91b143bcda097401f0c4a26be67ab8ff..f03fef0774694a5f6bef474750a8ec456d6e9abd 100644 (file)
@@ -22,6 +22,9 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
+use 5.006;
+use strict;
+use warnings;
 
 BEGIN
 {
@@ -35,15 +38,14 @@ BEGIN
   $ENV{'SHELL'} = '@SHELL@' if ($^O eq 'dos');
 }
 
+use File::Basename;
+
 use Autom4te::C4che;
 use Autom4te::ChannelDefs;
 use Autom4te::Channels;
 use Autom4te::FileUtils;
 use Autom4te::General;
 use Autom4te::XFile;
-use File::Basename;
-use strict;
-use warnings;
 
 # Data directory.
 my $pkgdatadir = $ENV{'AC_MACRODIR'} || '@pkgdatadir@';
index eea69da4e964f648e8c9a921b88a497e8c7f2160..a3424f952aae173c398b8db5b970f6b786af470a 100644 (file)
@@ -24,6 +24,10 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
 # Written by David J. MacKenzie.
 # Extended and rewritten in Perl by Akim Demaille.
 
+use 5.006;
+use strict;
+use warnings;
+
 BEGIN
 {
   my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
@@ -36,16 +40,15 @@ BEGIN
   $ENV{'SHELL'} = '@SHELL@' if ($^O eq 'dos');
 }
 
+# Do not use Cwd::chdir, since it might hang.
+use Cwd qw (cwd);
+
 use Autom4te::ChannelDefs;
 use Autom4te::Channels;
 use Autom4te::Configure_ac;
 use Autom4te::FileUtils;
 use Autom4te::General;
 use Autom4te::XFile;
-# Do not use Cwd::chdir, since it might hang.
-use Cwd 'cwd';
-use strict;
-use warnings;
 
 ## ----------- ##
 ## Variables.  ##
index 0026c428535c7f6f7208d9f4850657f74551eeed..ef7e0c12b41ccfe945e407ef2024716d1d840862 100644 (file)
 eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
     if 0;
 
+use 5.006;
+use strict;
+use warnings;
+
 BEGIN
 {
   my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
@@ -35,15 +39,14 @@ BEGIN
   $ENV{'SHELL'} = '@SHELL@' if ($^O eq 'dos');
 }
 
+use File::Basename;
+use File::Find;
+
 use Autom4te::ChannelDefs;
 use Autom4te::Configure_ac;
-use Autom4te::General;
 use Autom4te::FileUtils;
+use Autom4te::General;
 use Autom4te::XFile;
-use File::Basename;
-use File::Find;
-use strict;
-use warnings;
 
 use vars qw(@cfiles @makefiles @shfiles @subdirs %printed);
 
index af8dd55bbf80752ce20891b61c3eb1ed175664f6..c4ae4bdea5dbfcfa3888f182eb878b0349e27b72 100644 (file)
 eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
     if 0;
 
+use 5.006;
+use strict;
+use warnings;
+
 BEGIN
 {
   my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
@@ -36,15 +40,14 @@ BEGIN
   $ENV{'SHELL'} = '@SHELL@' if ($^O eq 'dos');
 }
 
+use File::Basename;
+
 use Autom4te::ChannelDefs;
 use Autom4te::Channels;
 use Autom4te::Configure_ac;
 use Autom4te::FileUtils;
 use Autom4te::General;
 use Autom4te::XFile;
-use File::Basename;
-use strict;
-use warnings;
 
 # Lib files.
 my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@';
index f60d3a0f516385b2cdd381ad0f168ca877b93059..72abe8811406b190b9dd75462eeeb7f9548c4f5b 100644 (file)
@@ -29,6 +29,10 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
 # Written by David MacKenzie <djm@gnu.ai.mit.edu>
 # and Paul Eggert <eggert@twinsun.com>.
 
+use 5.006;
+use strict;
+use warnings;
+
 BEGIN
 {
   my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
@@ -44,7 +48,6 @@ BEGIN
 use Autom4te::General;
 use Autom4te::XFile;
 use Autom4te::FileUtils;
-use warnings;
 
 # $HELP
 # -----
index 6226cd634e2a25d178ba2e07c0d752c3a4bf06f6..2032f59c502b03f7b2611ab52486254f6f058506 100644 (file)
@@ -31,12 +31,15 @@ This Perl module handles the cache of M4 runs used by autom4te.
 
 =cut
 
-use Data::Dumper;
-use Autom4te::Request;
-use Carp;
+use 5.006;
 use strict;
 use warnings;
 
+use Carp;
+use Data::Dumper;
+
+use Autom4te::Request;
+
 =over 4
 
 =item @request
@@ -50,7 +53,7 @@ work with "my" vars, and I do not know whether the current behavior
 
 =cut
 
-use vars qw(@request);
+use vars qw (@request);
 
 =item C<$req = Autom4te::C4che-E<gt>retrieve (%attr)>
 
index c706b6dc8211369d545b68e3b0a478f234c67c81..24e4bb610177a880998b3a500b939ba3f7e70f90 100644 (file)
@@ -50,10 +50,10 @@ shorthand function to output on specific channels.
 use 5.006;
 use strict;
 use warnings;
-use Exporter;
 
-use vars qw (@ISA @EXPORT);
+use Exporter;
 
+use vars qw (@EXPORT @ISA);
 @ISA = qw (Exporter);
 @EXPORT = qw (&prog_error &error &fatal &verb
              &switch_warning &parse_WARNINGS &parse_warnings);
index ffe7361cbce52e047533523bdecbf4c343a68431..f2f4b997d880f2ff5d2ffb2ba206ff67608c909c 100644 (file)
@@ -69,11 +69,12 @@ etc.) that can also be overridden on a per-message basis.
 use 5.006;
 use strict;
 use warnings;
-use Exporter;
+
 use Carp;
+use Exporter;
 use File::Basename;
 
-use vars qw (@ISA @EXPORT %channels $me);
+use vars qw (@EXPORT @ISA %channels $me);
 
 @ISA = qw (Exporter);
 @EXPORT = qw ($exit_code $warnings_are_errors
index bf3ad99b75fcdebc5b24b3df065256b7a37dd593..f84e733612f2bbbf037eb96c9332e94b041cd590 100644 (file)
@@ -23,12 +23,13 @@ package Autom4te::Configure_ac;
 use 5.006;
 use strict;
 use warnings;
+
 use Exporter;
-use Autom4te::Channels;
-use Autom4te::ChannelDefs;
 
-use vars qw (@ISA @EXPORT);
+use Autom4te::ChannelDefs;
+use Autom4te::Channels;
 
+use vars qw (@EXPORT @ISA);
 @ISA = qw (Exporter);
 @EXPORT = qw (&find_configure_ac &require_configure_ac);
 
index 7b7959f92263d5eb17dae752494afa1d17bf7656..ef1a2a7f46b083270d5d78aaf0db8396f602c65e 100644 (file)
@@ -37,14 +37,15 @@ This perl module provides various general purpose file handling functions.
 use 5.006;
 use strict;
 use warnings;
+
 use Exporter;
 use File::stat;
 use IO::File;
-use Autom4te::Channels;
-use Autom4te::ChannelDefs;
 
-use vars qw (@ISA @EXPORT);
+use Autom4te::ChannelDefs;
+use Autom4te::Channels;
 
+use vars qw (@EXPORT @ISA);
 @ISA = qw (Exporter);
 @EXPORT = qw (&contents
              &find_file &mtime
index 76dbd42609821f2ba7c2004d46a02f7d7717392a..922e4767b8bd9fadd98499a21d119b12a235f592 100644 (file)
@@ -33,19 +33,21 @@ used in several executables of the Autoconf package.
 =cut
 
 use 5.006;
+use strict;
+use warnings;
+
+use Carp;
 use Exporter;
-use Autom4te::ChannelDefs;
-use Autom4te::Channels;
-use Autom4te::Getopt ();
 use File::Basename;
 use File::Path ();
 use File::stat;
 use IO::File;
-use Carp;
-use strict;
-use warnings;
-use vars qw (@ISA @EXPORT);
 
+use Autom4te::ChannelDefs;
+use Autom4te::Channels;
+use Autom4te::Getopt ();
+
+use vars qw (@EXPORT @ISA);
 @ISA = qw (Exporter);
 
 # Variables we define and export.
index 42133e325ff65abc20b3938a25d88c9c984cffe1..f70a5c585fef722b2c725faeae387370904fd6da 100644 (file)
@@ -33,14 +33,16 @@ line options in conformance to the GNU Coding standards.
 use 5.006;
 use strict;
 use warnings FATAL => 'all';
+
+use Carp qw (confess croak);
 use Exporter ();
 use Getopt::Long ();
-use Autom4te::ChannelDefs qw/fatal/;
-use Carp qw/croak confess/;
 
-use vars qw (@ISA @EXPORT);
+use Autom4te::ChannelDefs qw (fatal);
+
+use vars qw (@EXPORT @ISA);
 @ISA = qw (Exporter);
-@EXPORT= qw/getopt/;
+@EXPORT = qw (getopt);
 
 =item C<parse_options (%option)>
 
index 5db75463520e7ce1d5d5ca5b4fc9bfed6a16d454..0b97615dafb17acbe1d2b28b516ae2484495bf83 100644 (file)
@@ -32,10 +32,12 @@ used in several executables of the Autoconf and Automake packages.
 
 =cut
 
+use 5.006;
 use strict;
 use warnings;
-use Class::Struct;
+
 use Carp;
+use Class::Struct;
 use Data::Dumper;
 
 struct
index 538d383b0eed953acc1e296921efa898eb5df868..8a49ac1a5d0bf0960732011a5de7a6b2e210b7b0 100644 (file)
@@ -72,23 +72,22 @@ and C<getlines> methods to translate C<\r\n> to C<\n>.
 use 5.006;
 use strict;
 use warnings;
-use vars qw($VERSION @EXPORT @EXPORT_OK $AUTOLOAD @ISA);
+
 use Carp;
+use DynaLoader;
 use Errno;
-use IO::File;
+use Exporter;
 use File::Basename;
+use IO::File;
+
 use Autom4te::ChannelDefs;
-use Autom4te::Channels qw(msg);
+use Autom4te::Channels qw (msg);
 use Autom4te::FileUtils;
 
-require Exporter;
-require DynaLoader;
-
-@ISA = qw(IO::File Exporter DynaLoader);
-
-$VERSION = "1.2";
-
+use vars qw ($AUTOLOAD @EXPORT @EXPORT_OK @ISA $VERSION);
+@ISA = qw (DynaLoader Exporter IO::File);
 @EXPORT = @IO::File::EXPORT;
+$VERSION = "1.2";
 
 eval {
   # Make all Fcntl O_XXX and LOCK_XXX constants available for importing