automake-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[automake-commit] 03/04: Consistently use ‘our’ instead of ‘use vars’.


From: Zack Weinberg
Subject: [automake-commit] 03/04: Consistently use ‘our’ instead of ‘use vars’.
Date: Mon, 14 Sep 2020 08:41:58 -0400

zackw pushed a commit to branch master
in repository automake.

View the commit online:
https://git.savannah.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=74673d1cbd3c789b26839f0c1a88ca032d47d058

commit 74673d1cbd3c789b26839f0c1a88ca032d47d058
Author: Zack Weinberg <zackw@panix.com>
AuthorDate: Fri Sep 11 18:03:19 2020 -0400

    Consistently use ‘our’ instead of ‘use vars’.
    
    At file scope of a file containing at most one ‘package’ declaration,
    ‘use vars’ is exactly equivalent to ‘our’, and the latter is preferred
    starting with Perl 5.6.0, which happens to be the oldest version we
    support.
    
    (This change has nothing to do with the previous two, but I want to make the
    same change in Autoconf and that means doing it here for all the files 
synced
    from Automake.)
    
    (I don’t know why, but this change exposed a latent bug in FileUtils.pm 
where
    the last pod block in the file didn’t have a ‘=cut’ delimiter, so the code
    after it was considered documentation, causing ‘require FileUtils’ to fail.)
    
    * lib/Automake/ChannelDefs.pm
    * lib/Automake/Channels.pm
    * lib/Automake/Condition.pm
    * lib/Automake/Configure_ac.pm
    * lib/Automake/DisjConditions.pm
    * lib/Automake/FileUtils.pm
    * lib/Automake/General.pm
    * lib/Automake/Getopt.pm
    * lib/Automake/Options.pm
    * lib/Automake/Rule.pm
    * lib/Automake/RuleDef.pm
    * lib/Automake/VarDef.pm
    * lib/Automake/Variable.pm
    * lib/Automake/Wrap.pm
    * lib/Automake/XFile.pm:
      Replace all uses of ‘use vars’ with ‘our’.
    
    * lib/Automake/FileUtils.pm:
      Add missing ‘=cut’ to a pod block near the end of the file.
---
 lib/Automake/ChannelDefs.pm    |  7 +++---
 lib/Automake/Channels.pm       | 55 ++++++++++++++++++------------------------
 lib/Automake/Condition.pm      |  7 +++---
 lib/Automake/Configure_ac.pm   |  5 ++--
 lib/Automake/DisjConditions.pm |  2 +-
 lib/Automake/FileUtils.pm      | 19 ++++++++-------
 lib/Automake/General.pm        |  9 +++----
 lib/Automake/Getopt.pm         |  5 ++--
 lib/Automake/Options.pm        | 27 ++++++++++-----------
 lib/Automake/Rule.pm           | 22 ++++++++---------
 lib/Automake/RuleDef.pm        |  5 ++--
 lib/Automake/VarDef.pm         |  7 +++---
 lib/Automake/Variable.pm       | 29 +++++++++++-----------
 lib/Automake/Wrap.pm           |  5 ++--
 lib/Automake/XFile.pm          |  7 +++---
 15 files changed, 94 insertions(+), 117 deletions(-)

diff --git a/lib/Automake/ChannelDefs.pm b/lib/Automake/ChannelDefs.pm
index 1693c05..b98191b 100644
--- a/lib/Automake/ChannelDefs.pm
+++ b/lib/Automake/ChannelDefs.pm
@@ -61,10 +61,9 @@ BEGIN
     }
 }
 
-use vars qw (@EXPORT @ISA);
-@ISA = qw (Exporter);
-@EXPORT = qw (&prog_error &error &fatal &verb
-             &switch_warning &parse_WARNINGS &parse_warnings);
+our @ISA = qw (Exporter);
+our @EXPORT = qw (&prog_error &error &fatal &verb
+                 &switch_warning &parse_WARNINGS &parse_warnings);
 
 =head2 CHANNELS
 
diff --git a/lib/Automake/Channels.pm b/lib/Automake/Channels.pm
index 7cc7ffd..02f03f8 100644
--- a/lib/Automake/Channels.pm
+++ b/lib/Automake/Channels.pm
@@ -74,19 +74,19 @@ use Carp;
 use Exporter;
 use File::Basename;
 
-use vars qw (@EXPORT @ISA %channels $me);
-@ISA = qw (Exporter);
-@EXPORT = qw ($exit_code $warnings_are_errors
-             &reset_local_duplicates &reset_global_duplicates
-             &register_channel &msg &exists_channel &channel_type
-             &setup_channel &setup_channel_type
-             &dup_channel_setup &drop_channel_setup
-             &buffer_messages &flush_messages
-             &setup_channel_queue &pop_channel_queue
-             US_GLOBAL US_LOCAL
-             UP_NONE UP_TEXT UP_LOC_TEXT);
-
-$me = basename $0;
+our @ISA = qw (Exporter);
+our @EXPORT = qw ($exit_code $warnings_are_errors
+                 &reset_local_duplicates &reset_global_duplicates
+                 &register_channel &msg &exists_channel &channel_type
+                 &setup_channel &setup_channel_type
+                 &dup_channel_setup &drop_channel_setup
+                 &buffer_messages &flush_messages
+                 &setup_channel_queue &pop_channel_queue
+                 US_GLOBAL US_LOCAL
+                 UP_NONE UP_TEXT UP_LOC_TEXT);
+
+our %channels;
+our $me = basename $0;
 
 =head2 Global Variables
 
@@ -99,8 +99,7 @@ the C<exit_code> options of C<fatal> and C<error> channels.
 
 =cut
 
-use vars qw ($exit_code);
-$exit_code = 0;
+our $exit_code = 0;
 
 =item C<$warnings_are_errors>
 
@@ -109,8 +108,7 @@ errors (i.e. if they should update C<$exit_code>).
 
 =cut
 
-use vars qw ($warnings_are_errors);
-$warnings_are_errors = 0;
+our $warnings_are_errors = 0;
 
 =back
 
@@ -260,11 +258,8 @@ be ignored.
 
 =cut
 
-use vars qw (%_default_options %_global_duplicate_messages
-            %_local_duplicate_messages);
-
 # Default options for a channel.
-%_default_options =
+our %_default_options =
   (
    type => 'warning',
    exit_code => 1,
@@ -284,8 +279,8 @@ use vars qw (%_default_options %_global_duplicate_messages
 # Filled with output messages as keys, to detect duplicates.
 # The value associated with each key is the number of occurrences
 # filtered out.
-%_local_duplicate_messages = ();
-%_global_duplicate_messages = ();
+our %_local_duplicate_messages = ();
+our %_global_duplicate_messages = ();
 
 sub _reset_duplicates (\%)
 {
@@ -404,8 +399,7 @@ sub _format_sub_message ($$)
 }
 
 # Store partial messages here. (See the 'partial' option.)
-use vars qw ($partial);
-$partial = '';
+our $partial = '';
 
 # _format_message ($LOCATION, $MESSAGE, %OPTIONS)
 # -----------------------------------------------
@@ -620,11 +614,9 @@ both print
 =cut
 
 
-use vars qw (@backlog %buffering);
-
 # See buffer_messages() and flush_messages() below.
-%buffering = ();       # The map of channel types to buffer.
-@backlog = ();         # The buffer of messages.
+our %buffering = ();   # The map of channel types to buffer.
+our @backlog = ();             # The buffer of messages.
 
 sub msg ($$;$%)
 {
@@ -716,9 +708,8 @@ entry, while C<drop_channel_setup ()> just deletes it.
 
 =cut
 
-use vars qw (@_saved_channels @_saved_werrors);
-@_saved_channels = ();
-@_saved_werrors = ();
+our @_saved_channels = ();
+our @_saved_werrors = ();
 
 sub dup_channel_setup ()
 {
diff --git a/lib/Automake/Condition.pm b/lib/Automake/Condition.pm
index 072602a..437a5c7 100644
--- a/lib/Automake/Condition.pm
+++ b/lib/Automake/Condition.pm
@@ -22,9 +22,8 @@ use warnings FATAL => 'all';
 use Carp;
 use Exporter;
 
-use vars qw (@EXPORT_OK @ISA);
-@ISA = qw (Exporter);
-@EXPORT_OK = qw (TRUE FALSE reduce_and reduce_or);
+our @ISA = qw (Exporter);
+our @EXPORT_OK = qw (TRUE FALSE reduce_and reduce_or);
 
 =head1 NAME
 
@@ -169,7 +168,7 @@ both create the C<"FALSE"> condition).
 # Keys in this hash are conditional strings. Values are the
 # associated object conditions.  This is used by 'new' to reuse
 # Condition objects with identical conditionals.
-use vars '%_condition_singletons';
+our %_condition_singletons;
 # Do NOT reset this hash here.  It's already empty by default,
 # and any setting would otherwise occur AFTER the 'TRUE' and 'FALSE'
 # constants definitions.
diff --git a/lib/Automake/Configure_ac.pm b/lib/Automake/Configure_ac.pm
index 0d9b465..bc501b1 100644
--- a/lib/Automake/Configure_ac.pm
+++ b/lib/Automake/Configure_ac.pm
@@ -29,9 +29,8 @@ use Exporter;
 use Automake::ChannelDefs;
 use Automake::Channels;
 
-use vars qw (@EXPORT @ISA);
-@ISA = qw (Exporter);
-@EXPORT = qw (&find_configure_ac &require_configure_ac);
+our @ISA = qw (Exporter);
+our @EXPORT = qw (&find_configure_ac &require_configure_ac);
 
 =head1 NAME
 
diff --git a/lib/Automake/DisjConditions.pm b/lib/Automake/DisjConditions.pm
index af9d1a9..164e488 100644
--- a/lib/Automake/DisjConditions.pm
+++ b/lib/Automake/DisjConditions.pm
@@ -141,7 +141,7 @@ ignored.
 # Keys in this hash are DisjConditions strings. Values are the
 # associated object DisjConditions.  This is used by 'new' to reuse
 # DisjConditions objects with identical conditions.
-use vars '%_disjcondition_singletons';
+our %_disjcondition_singletons;
 
 sub new ($;@)
 {
diff --git a/lib/Automake/FileUtils.pm b/lib/Automake/FileUtils.pm
index 65f9216..0285165 100644
--- a/lib/Automake/FileUtils.pm
+++ b/lib/Automake/FileUtils.pm
@@ -45,14 +45,13 @@ use IO::File;
 use Automake::Channels;
 use Automake::ChannelDefs;
 
-use vars qw (@EXPORT @ISA);
-@ISA = qw (Exporter);
-@EXPORT = qw (&contents
-             &find_file &mtime
-             &update_file
-             &xsystem &xsystem_hint &xqx
-             &dir_has_case_matching_file &reset_dir_cache
-             &set_dir_cache_file);
+our @ISA = qw (Exporter);
+our @EXPORT = qw (&contents
+                 &find_file &mtime
+                 &update_file
+                 &xsystem &xsystem_hint &xqx
+                 &dir_has_case_matching_file &reset_dir_cache
+                 &set_dir_cache_file);
 
 =over 4
 
@@ -332,7 +331,7 @@ same file).
 
 =cut
 
-use vars '%_directory_cache';
+our %_directory_cache;
 sub dir_has_case_matching_file ($$)
 {
   # Note that print File::Spec->case_tolerant returns 0 even on MacOS
@@ -383,4 +382,6 @@ sub set_dir_cache_file ($$)
 
 =back
 
+=cut
+
 1; # for require
diff --git a/lib/Automake/General.pm b/lib/Automake/General.pm
index ea7032c..59efd21 100644
--- a/lib/Automake/General.pm
+++ b/lib/Automake/General.pm
@@ -22,16 +22,13 @@ use warnings FATAL => 'all';
 use Exporter;
 use File::Basename;
 
-use vars qw (@EXPORT @ISA);
-
-@ISA = qw (Exporter);
-@EXPORT = qw (&uniq &none $me);
+our @ISA = qw (Exporter);
+our @EXPORT = qw (&uniq &none $me);
 
 # Variable we share with the main package.  Be sure to have a single
 # copy of them: using 'my' together with multiple inclusion of this
 # package would introduce several copies.
-use vars qw ($me);
-$me = basename ($0);
+our $me = basename ($0);
 
 # END
 # ---
diff --git a/lib/Automake/Getopt.pm b/lib/Automake/Getopt.pm
index 5d7d57b..d5910ab 100644
--- a/lib/Automake/Getopt.pm
+++ b/lib/Automake/Getopt.pm
@@ -40,9 +40,8 @@ use Getopt::Long ();
 
 use Automake::ChannelDefs qw (fatal);
 
-use vars qw (@EXPORT @ISA);
-@ISA = qw (Exporter);
-@EXPORT = qw (getopt);
+our @ISA = qw (Exporter);
+our @EXPORT = qw (getopt);
 
 =item C<parse_options (%option)>
 
diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm
index 5e20a34..b846fee 100644
--- a/lib/Automake/Options.pm
+++ b/lib/Automake/Options.pm
@@ -26,14 +26,13 @@ use Automake::ChannelDefs;
 use Automake::Channels;
 use Automake::Version;
 
-use vars qw (@EXPORT @ISA);
-@ISA = qw (Exporter);
-@EXPORT = qw (option global_option
-              set_option set_global_option
-              unset_option unset_global_option
-              process_option_list process_global_option_list
-              set_strictness $strictness $strictness_name
-              &FOREIGN &GNU &GNITS);
+our @ISA = qw (Exporter);
+our @EXPORT = qw (option global_option
+                 set_option set_global_option
+                 unset_option unset_global_option
+                 process_option_list process_global_option_list
+                 set_strictness $strictness $strictness_name
+                 &FOREIGN &GNU &GNITS);
 
 =head1 NAME
 
@@ -74,14 +73,14 @@ F<Makefile.am>s.
 =cut
 
 # Values are the Automake::Location of the definition.
-use vars '%_options';        # From AUTOMAKE_OPTIONS
-use vars '%_global_options'; # From AM_INIT_AUTOMAKE or the command line.
+our %_options;        # From AUTOMAKE_OPTIONS
+our %_global_options; # From AM_INIT_AUTOMAKE or the command line.
 
 # Whether process_option_list has already been called for the current
 # Makefile.am.
-use vars '$_options_processed';
+our $_options_processed;
 # Whether process_global_option_list has already been called.
-use vars '$_global_options_processed';
+our $_global_options_processed;
 
 =head2 Constants
 
@@ -121,10 +120,10 @@ The current strictness name.  One of C<'foreign'>, 
C<'gnu'>, or C<'gnits'>.
 =cut
 
 # Strictness levels.
-use vars qw ($strictness $strictness_name);
+our ($strictness, $strictness_name);
 
 # Strictness level as set on command line.
-use vars qw ($_default_strictness $_default_strictness_name);
+our ($_default_strictness, $_default_strictness_name);
 
 
 =head2 Functions
diff --git a/lib/Automake/Rule.pm b/lib/Automake/Rule.pm
index 0227a85..5336422 100644
--- a/lib/Automake/Rule.pm
+++ b/lib/Automake/Rule.pm
@@ -30,14 +30,13 @@ use Automake::Options;
 use Automake::Condition qw (TRUE FALSE);
 use Automake::DisjConditions;
 
-use vars qw (@EXPORT @EXPORT_OK @ISA);
-@ISA = qw (Automake::Item Exporter);
-@EXPORT = qw (reset register_suffix_rule next_in_suffix_chain
-             suffixes rules $KNOWN_EXTENSIONS_PATTERN
-             depend %dependencies %actions register_action
-             accept_extensions
-             reject_rule msg_rule msg_cond_rule err_rule err_cond_rule
-             rule rrule ruledef rruledef);
+our @ISA = qw (Automake::Item Exporter);
+our @EXPORT = qw (reset register_suffix_rule next_in_suffix_chain
+                 suffixes rules $KNOWN_EXTENSIONS_PATTERN
+                 depend %dependencies %actions register_action
+                 accept_extensions
+                 reject_rule msg_rule msg_cond_rule err_rule err_cond_rule
+                 rule rrule ruledef rruledef);
 
 =head1 NAME
 
@@ -123,7 +122,7 @@ Makefile: keeping related stuff altogether.
 
 =cut
 
-use vars '%dependencies';
+our %dependencies;
 
 =item <%actions>
 
@@ -132,7 +131,7 @@ only when keys exists in C<%dependencies>.
 
 =cut
 
-use vars '%actions';
+our %actions;
 
 =item C<$KNOWN_EXTENSIONS_PATTERN>
 
@@ -145,8 +144,7 @@ New extensions should be registered with 
C<accept_extensions>.
 
 =cut
 
-use vars qw ($KNOWN_EXTENSIONS_PATTERN);
-$KNOWN_EXTENSIONS_PATTERN = "";
+our $KNOWN_EXTENSIONS_PATTERN = "";
 
 =back
 
diff --git a/lib/Automake/RuleDef.pm b/lib/Automake/RuleDef.pm
index 091a78c..73929da 100644
--- a/lib/Automake/RuleDef.pm
+++ b/lib/Automake/RuleDef.pm
@@ -25,9 +25,8 @@ use Exporter;
 use Automake::ChannelDefs;
 use Automake::ItemDef;
 
-use vars qw (@EXPORT @ISA);
-@ISA = qw (Automake::ItemDef Exporter);
-@EXPORT = qw (&RULE_AUTOMAKE &RULE_USER);
+our @ISA = qw (Automake::ItemDef Exporter);
+our @EXPORT = qw (&RULE_AUTOMAKE &RULE_USER);
 
 =head1 NAME
 
diff --git a/lib/Automake/VarDef.pm b/lib/Automake/VarDef.pm
index adeb6e2..3bde2e1 100644
--- a/lib/Automake/VarDef.pm
+++ b/lib/Automake/VarDef.pm
@@ -25,10 +25,9 @@ use Exporter;
 use Automake::ChannelDefs;
 use Automake::ItemDef;
 
-use vars qw (@ISA @EXPORT);
-@ISA = qw (Automake::ItemDef Exporter);
-@EXPORT = qw (&VAR_AUTOMAKE &VAR_CONFIGURE &VAR_MAKEFILE
-             &VAR_ASIS &VAR_PRETTY &VAR_SILENT &VAR_SORTED);
+our @ISA = qw (Automake::ItemDef Exporter);
+our @EXPORT = qw (&VAR_AUTOMAKE &VAR_CONFIGURE &VAR_MAKEFILE
+                 &VAR_ASIS &VAR_PRETTY &VAR_SILENT &VAR_SORTED);
 
 =head1 NAME
 
diff --git a/lib/Automake/Variable.pm b/lib/Automake/Variable.pm
index 4ec0dd4..32db936 100644
--- a/lib/Automake/Variable.pm
+++ b/lib/Automake/Variable.pm
@@ -32,19 +32,18 @@ use Automake::DisjConditions;
 use Automake::General 'uniq';
 use Automake::Wrap 'makefile_wrap';
 
-use vars qw (@EXPORT @EXPORT_OK @ISA);
-@ISA = qw (Automake::Item Exporter);
-@EXPORT = qw (err_var msg_var msg_cond_var reject_var
-             var rvar vardef rvardef
-             variables
-             scan_variable_expansions check_variable_expansions
-             variable_delete
-             variables_dump
-             set_seen
-             require_variables
-             variable_value
-             output_variables
-             transform_variable_recursively);
+our @ISA = qw (Automake::Item Exporter);
+our @EXPORT = qw (err_var msg_var msg_cond_var reject_var
+                 var rvar vardef rvardef
+                 variables
+                 scan_variable_expansions check_variable_expansions
+                 variable_delete
+                 variables_dump
+                 set_seen
+                 require_variables
+                 variable_value
+                 output_variables
+                 transform_variable_recursively);
 
 =head1 NAME
 
@@ -301,7 +300,7 @@ is the value being appended to  C<$varname>.
 
 =cut
 
-use vars '%_hooks';
+our %_hooks;
 sub hook ($$)
 {
   my ($var, $fun) = @_;
@@ -316,7 +315,7 @@ the L<Automake::Variable> instances that ends with 
C<_$suffix>.
 
 =cut
 
-use vars '%_variable_dict', '%_primary_dict';
+our (%_variable_dict, %_primary_dict);
 sub variables (;$)
 {
   my ($suffix) = @_;
diff --git a/lib/Automake/Wrap.pm b/lib/Automake/Wrap.pm
index c821b8b..639996d 100644
--- a/lib/Automake/Wrap.pm
+++ b/lib/Automake/Wrap.pm
@@ -21,9 +21,8 @@ use warnings FATAL => 'all';
 
 use Exporter;
 
-use vars qw (@EXPORT_OK @ISA);
-@ISA = qw (Exporter);
-@EXPORT_OK = qw (wrap makefile_wrap);
+our @ISA = qw (Exporter);
+our @EXPORT_OK = qw (wrap makefile_wrap);
 
 =head1 NAME
 
diff --git a/lib/Automake/XFile.pm b/lib/Automake/XFile.pm
index 5284faa..d0cf32c 100644
--- a/lib/Automake/XFile.pm
+++ b/lib/Automake/XFile.pm
@@ -81,10 +81,9 @@ use Automake::ChannelDefs;
 use Automake::Channels qw (msg);
 use Automake::FileUtils;
 
-use vars qw ($AUTOLOAD @EXPORT @EXPORT_OK @ISA $VERSION);
-@ISA = qw(Exporter IO::File);
-@EXPORT = @IO::File::EXPORT;
-$VERSION = "1.2";
+our @ISA = qw(Exporter IO::File);
+our @EXPORT = @IO::File::EXPORT;
+our $VERSION = "1.2";
 
 eval {
   # Make all Fcntl O_XXX and LOCK_XXX constants available for importing



reply via email to

[Prev in Thread] Current Thread [Next in Thread]