Skip to content

Commit

Permalink
Use my instead of local for local variables
Browse files Browse the repository at this point in the history
To comply with the perlcritic Variables::ProhibitLocalVars policy.
  • Loading branch information
Julien-Elie committed Sep 8, 2024
1 parent c3e707e commit a5f581c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 19 deletions.
23 changes: 12 additions & 11 deletions contrib/archivegz.in
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ if ($timeout < 1) { $timeout = 1; }
# --------------------------------------------------------------------

sub regexp_escape {
local ($data) = @_;
my ($data) = @_;

$data =~ s+\\+\\\\+gi; # replace \ with \\
$data =~ s+\/+\\\/+gi; # replace / with \/
Expand All @@ -71,8 +71,8 @@ sub regexp_escape {
}

sub fhbits {
local (@fhlist) = split(' ', $_[0]);
local ($bits);
my (@fhlist) = split(' ', $_[0]);
my ($bits);
for (@fhlist) {
vec($bits, fileno($_), 1) = 1;
}
Expand All @@ -81,18 +81,19 @@ sub fhbits {

sub timed_getline {
my ($fileh, $timeout) = @_;
local (*FILEH) = *$fileh{FILEHANDLE};

local ($rin, $win, $ein);
local ($rout, $wout, $eout);
local (*FILEH) = *$fileh{FILEHANDLE}; ## no critic (ProhibitLocalVars)

my ($rin, $win, $ein);
my ($rout, $wout, $eout);
$rin = $win = $ein = '';
$rin = fhbits('FILEH');
$ein = $rin | $win;
local ($nfound);
local ($offset) = 0;
local ($accum) = '';
local ($done) = 0;
local ($result);
my ($nfound);
my ($offset) = 0;
my ($accum) = '';
my ($done) = 0;
my ($result);

$nfound = select($rout = $rin, $wout = $win, $eout = $ein, $timeout);

Expand Down
2 changes: 1 addition & 1 deletion contrib/makeexpctl.in
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ close(OUTFILE);
exit(1);

sub printline {
local ($grpstr, $mflag, $len) = @_;
my ($grpstr, $mflag, $len) = @_;
print OUTFILE $grpstr, ":", $mflag, ":", $len * $scale, ":",
$len * $scale, ":", $len * $scale, "\n";
}
14 changes: 8 additions & 6 deletions innfeed/testListener.pl
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,14 @@ sub sigHup {
$letstr = "abcdefghijklmnopqrstuvwxyz";

sub createArticle {
local ($counter) = @_;
local ($filename, $msgid, $i);
local ($time) = $^T;
local ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst)
= gmtime($time);
local ($index) = $counter;
my ($counter) = @_;
my ($filename, $msgid, $i);
my ($time) = $^T;
my (
$sec, $min, $hour, $mday, $mon, $year, $wday_unused, $yday_unused,
$isdst_unused,
) = gmtime($time);
my ($index) = $counter;

if ($opt_a && ((int(rand(4)) % 2) == 0)) {
$index = int($index / 2);
Expand Down
2 changes: 1 addition & 1 deletion storage/ovsqlite/ovsqlite-util.in
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ select groupid from groupinfo
# The AutoCommit attribute needs being true so as not to start a transaction.
sub pragma_foreign_keys {
my $onoff = shift;
local $dbh->{AutoCommit} = 1;
local $dbh->{AutoCommit} = 1; ## no critic (ProhibitLocalVars)
$dbh->do("pragma foreign_keys = $onoff;");
}

Expand Down

0 comments on commit a5f581c

Please sign in to comment.