Skip to content

Commit

Permalink
Merge pull request Perl#1 from guillemj/pu/no-use-vars
Browse files Browse the repository at this point in the history
Switch from «use vars» to «our» or «my»
  • Loading branch information
JohnPeacock committed Apr 13, 2018
2 parents f4eaad2 + 4c4ebb1 commit f871aa1
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 26 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.bs
*.o
MYMETA.*
Makefile
blib/
pm_to_blib
3 changes: 2 additions & 1 deletion Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ to support an earlier Perl release.
EOL
}

use vars qw ($no_xs $force_xs);
my ($no_xs, $force_xs);

unlink 'pm_to_blib'; # belts and braces

if ($ENV{PERL_ONLY}) {
Expand Down
7 changes: 3 additions & 4 deletions lib/version.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ if ($] >= 5.015) {
warnings::register_categories(qw/version/);
}

use vars qw(@ISA $VERSION $CLASS $STRICT $LAX *declare *qv);

$VERSION = 0.9921;
$CLASS = 'version';
our $VERSION = 0.9921;
our $CLASS = 'version';
our (@ISA, $STRICT, $LAX);

# !!!!Delete this next block completely when adding to Perl core!!!!
{
Expand Down
20 changes: 7 additions & 13 deletions lib/version/regex.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@ package version::regex;

use strict;

use vars qw(
$VERSION $CLASS $STRICT $LAX
$STRICT_DECIMAL_VERSION $STRICT_DOTTED_DECIMAL_VERSION
$LAX_DECIMAL_VERSION $LAX_DOTTED_DECIMAL_VERSION
);

$VERSION = 0.9921;
our $VERSION = 0.9921;

#--------------------------------------------------------------------------#
# Version regexp components
Expand Down Expand Up @@ -61,19 +55,19 @@ my $LAX_ALPHA_PART = qr/_[0-9]+/;

# Strict decimal version number.

$STRICT_DECIMAL_VERSION =
our $STRICT_DECIMAL_VERSION =
qr/ $STRICT_INTEGER_PART $FRACTION_PART? /x;

# Strict dotted-decimal version number. Must have both leading "v" and
# at least three parts, to avoid confusion with decimal syntax.

$STRICT_DOTTED_DECIMAL_VERSION =
our $STRICT_DOTTED_DECIMAL_VERSION =
qr/ v $STRICT_INTEGER_PART $STRICT_DOTTED_DECIMAL_PART{2,} /x;

# Complete strict version number syntax -- should generally be used
# anchored: qr/ \A $STRICT \z /x

$STRICT =
our $STRICT =
qr/ $STRICT_DECIMAL_VERSION | $STRICT_DOTTED_DECIMAL_VERSION /x;

#--------------------------------------------------------------------------#
Expand All @@ -84,7 +78,7 @@ $STRICT =
# allowing an alpha suffix or allowing a leading or trailing
# decimal-point

$LAX_DECIMAL_VERSION =
our $LAX_DECIMAL_VERSION =
qr/ $LAX_INTEGER_PART (?: $FRACTION_PART | \. )? $LAX_ALPHA_PART?
|
$FRACTION_PART $LAX_ALPHA_PART?
Expand All @@ -96,7 +90,7 @@ $LAX_DECIMAL_VERSION =
# enough, without the leading "v", Perl takes .1.2 to mean v0.1.2,
# so when there is no "v", the leading part is optional

$LAX_DOTTED_DECIMAL_VERSION =
our $LAX_DOTTED_DECIMAL_VERSION =
qr/
v $LAX_INTEGER_PART (?: $LAX_DOTTED_DECIMAL_PART+ $LAX_ALPHA_PART? )?
|
Expand All @@ -109,7 +103,7 @@ $LAX_DOTTED_DECIMAL_VERSION =
# The string 'undef' is a special case to make for easier handling
# of return values from ExtUtils::MM->parse_version

$LAX =
our $LAX =
qr/ undef | $LAX_DOTTED_DECIMAL_VERSION | $LAX_DECIMAL_VERSION /x;

#--------------------------------------------------------------------------#
Expand Down
3 changes: 1 addition & 2 deletions t/02derived.t
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ print $fh <<"EOF";
# This is an empty subclass
package $package;
use parent 'version';
use vars '\$VERSION';
\$VERSION=0.001;
our \$VERSION = 0.001;
EOF
close $fh;

Expand Down
8 changes: 5 additions & 3 deletions vperl/vpp.pm
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,11 @@ use strict;
use warnings::register;

use Config;
use vars qw($VERSION $CLASS @ISA $LAX $STRICT $WARN_CATEGORY);
$VERSION = 0.9921;
$CLASS = 'version::vpp';

our $VERSION = 0.9921;
our $CLASS = 'version::vpp';
our ($LAX, $STRICT, $WARN_CATEGORY);

if ($] > 5.015) {
warnings::register_categories(qw/version/);
$WARN_CATEGORY = 'version';
Expand Down
1 change: 1 addition & 0 deletions vutil/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vxs.c
6 changes: 3 additions & 3 deletions vutil/lib/version/vxs.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ package version::vxs;
use v5.10;
use strict;

use vars qw(@ISA $VERSION $CLASS );
$VERSION = 0.9921;
$CLASS = 'version::vxs';
our $VERSION = 0.9921;
our $CLASS = 'version::vxs';
our @ISA;

eval {
require XSLoader;
Expand Down

0 comments on commit f871aa1

Please sign in to comment.