Kaynağa Gözat

scripts: Unpack arguments just once

Addresses Subroutines::RequireArgUnpacking.

Warned-by: perlcritic
Guillem Jover 11 yıl önce
ebeveyn
işleme
f88c908b5f

+ 1 - 2
scripts/Dpkg/Changelog.pm

@@ -116,9 +116,8 @@ specified with $error and a copy of the line can be recorded in $line.
 
 sub parse_error {
     my ($self, $file, $line_nr, $error, $line) = @_;
-    shift;
 
-    push @{$self->{parse_errors}}, [ @_ ];
+    push @{$self->{parse_errors}}, [ $file, $line_nr, $error, $line ];
 
     if ($self->{verbose}) {
 	if ($line) {

+ 6 - 4
scripts/Dpkg/Compression/Process.pm

@@ -147,8 +147,9 @@ properly close the sub-process (and verify that it exited without error).
 =cut
 
 sub compress {
-    my $self = shift;
-    my %opts = $self->_sanity_check(@_);
+    my ($self, %opts) = @_;
+
+    $self->_sanity_check(%opts);
     my @prog = $self->get_compress_cmdline();
     $opts{exec} = \@prog;
     $self->{cmdline} = "@prog";
@@ -169,8 +170,9 @@ properly close the sub-process (and verify that it exited without error).
 =cut
 
 sub uncompress {
-    my $self = shift;
-    my %opts = $self->_sanity_check(@_);
+    my ($self, %opts) = @_;
+
+    $self->_sanity_check(%opts);
     my @prog = $self->get_uncompress_cmdline();
     $opts{exec} = \@prog;
     $self->{cmdline} = "@prog";

+ 2 - 2
scripts/Dpkg/Deps.pm

@@ -237,8 +237,8 @@ This should be set whenever working with build-deps.
 =cut
 
 sub deps_parse {
-    my $dep_line = shift;
-    my %options = (@_);
+    my ($dep_line, %options) = @_;
+
     $options{use_arch} //= 1;
     $options{reduce_arch} //= 0;
     $options{host_arch} //= get_host_arch();

+ 4 - 2
scripts/Dpkg/IPC.pm

@@ -202,9 +202,11 @@ sub _sanity_check_opts {
 }
 
 sub spawn {
-    my (%opts) = _sanity_check_opts(@_);
-    $opts{close_in_child} //= [];
+    my (%opts) = @_;
     my @prog;
+
+    _sanity_check_opts(%opts);
+    $opts{close_in_child} //= [];
     if (ref($opts{exec}) =~ /ARRAY/) {
 	push @prog, @{$opts{exec}};
     } elsif (not ref($opts{exec})) {

+ 3 - 7
scripts/Dpkg/Shlibs/Symbol.pm

@@ -33,9 +33,8 @@ use Dpkg::Shlibs::Cppfilt;
 use constant ALIAS_TYPES => qw(c++ symver);
 
 sub new {
-    my $this = shift;
+    my ($this, %args) = @_;
     my $class = ref($this) || $this;
-    my %args = @_;
     my $self = bless {
 	symbol => undef,
 	symbol_templ => undef,
@@ -51,12 +50,9 @@ sub new {
 
 # Deep clone
 sub clone {
-    my $self = shift;
+    my ($self, %args) = @_;
     my $clone = Storable::dclone($self);
-    if (@_) {
-	my %args=@_;
-	$clone->{$_} = $args{$_} foreach keys %args;
-    }
+    $clone->{$_} = $args{$_} foreach keys %args;
     return $clone;
 }
 

+ 1 - 2
scripts/Dpkg/Shlibs/SymbolFile.pm

@@ -88,8 +88,7 @@ sub symbol_is_blacklisted {
 }
 
 sub new {
-    my $this = shift;
-    my %opts=@_;
+    my ($this, %opts) = @_;
     my $class = ref($this) || $this;
     my $self = \%opts;
     bless $self, $class;