diff options
author | Guillem Jover <guillem@debian.org> | 2012-12-29 23:59:06 +0100 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2013-04-19 05:34:04 +0200 |
commit | 26a4d1df1119da0a8601b27198086086f9f3249f (patch) | |
tree | 3596d485e27f1bf47baf393dd78351cee4882578 | |
parent | 0baef9061f7736f6179446d9f1f8e372ce98515b (diff) | |
download | dpkg-26a4d1df1119da0a8601b27198086086f9f3249f.tar.gz |
Use just 'return' instead of 'return undef' in perl code
This makes sure the functions always return the appropriate value
independent of the context.
Fixes Subroutines::ProhibitExplicitReturnUndef.
Warned-by: perlcritic
26 files changed, 94 insertions, 97 deletions
diff --git a/dselect/methods/Debian/Dselect/Ftp.pm b/dselect/methods/Debian/Dselect/Ftp.pm index 37fe896f7..f750b42ab 100644 --- a/dselect/methods/Debian/Dselect/Ftp.pm +++ b/dselect/methods/Debian/Dselect/Ftp.pm @@ -311,7 +311,7 @@ sub do_mdtm { ) { $has_mdtm = 0; } elsif (!$ftp->ok()) { - return undef; + return; } #} @@ -320,7 +320,7 @@ sub do_mdtm { my @files = $ftp->dir($file); if (($#files == -1) || ($ftp->code == 550)) { # No such file or directory - return undef; + return; } # my $code=$ftp->code(); my $message=$ftp->message(); diff --git a/scripts/Dpkg/Arch.pm b/scripts/Dpkg/Arch.pm index bfc19f4e9..3ee450afc 100644 --- a/scripts/Dpkg/Arch.pm +++ b/scripts/Dpkg/Arch.pm @@ -253,7 +253,7 @@ sub debtriplet_to_gnutriplet(@) my ($abi, $os, $cpu) = @_; - return undef unless defined($abi) && defined($os) && defined($cpu) && + return unless defined($abi) && defined($os) && defined($cpu) && exists($cputable{$cpu}) && exists($ostable{"$abi-$os"}); return join("-", $cputable{$cpu}, $ostable{"$abi-$os"}); } @@ -261,9 +261,9 @@ sub debtriplet_to_gnutriplet(@) sub gnutriplet_to_debtriplet($) { my ($gnu) = @_; - return undef unless defined($gnu); + return unless defined($gnu); my ($gnu_cpu, $gnu_os) = split(/-/, $gnu, 2); - return undef unless defined($gnu_cpu) && defined($gnu_os); + return unless defined($gnu_cpu) && defined($gnu_os); read_cputable(); read_ostable(); @@ -284,7 +284,7 @@ sub gnutriplet_to_debtriplet($) } } - return undef if !defined($cpu) || !defined($os); + return if !defined($cpu) || !defined($os); return (split(/-/, $os, 2), $cpu); } @@ -314,11 +314,11 @@ sub debtriplet_to_debarch(@) my ($abi, $os, $cpu) = @_; if (!defined($abi) || !defined($os) || !defined($cpu)) { - return undef; + return; } elsif (exists $debtriplet_to_debarch{"$abi-$os-$cpu"}) { return $debtriplet_to_debarch{"$abi-$os-$cpu"}; } else { - return undef; + return; } } @@ -341,7 +341,7 @@ sub debarch_to_debtriplet($) if (defined($triplet)) { return split('-', $triplet, 3); } else { - return undef; + return; } } @@ -386,7 +386,7 @@ sub debarch_to_cpuattrs($) return ($abibits{$abi} || $cpubits{$cpu}, $cpuendian{$cpu}); } else { - return undef; + return; } } diff --git a/scripts/Dpkg/Changelog.pm b/scripts/Dpkg/Changelog.pm index 42f877d42..0ceda5c5c 100644 --- a/scripts/Dpkg/Changelog.pm +++ b/scripts/Dpkg/Changelog.pm @@ -332,15 +332,14 @@ sub get_range { return @$res if wantarray; return $res; } else { - return () if wantarray; - return undef; + return; } } sub _data_range { my ($self, $range) = @_; - my $data = $self->{data} or return undef; + my $data = $self->{data} or return; return [ @$data ] if $range->{all}; @@ -389,7 +388,7 @@ sub _data_range { } return \@result if scalar(@result); - return undef; + return; } =item $c->abort_early() @@ -518,7 +517,7 @@ BEGIN { sub dpkg { my ($self, $range) = @_; - my @data = $self->get_range($range) or return undef; + my @data = $self->get_range($range) or return; my $entry = shift @data; my $f = Dpkg::Control::Changelog->new(); @@ -583,7 +582,7 @@ the remarks about which values are taken from the first entry). sub rfc822 { my ($self, $range) = @_; - my @data = $self->get_range($range) or return undef; + my @data = $self->get_range($range) or return; my $index = Dpkg::Index->new(type => CTRL_CHANGELOG); foreach my $entry (@data) { diff --git a/scripts/Dpkg/Changelog/Entry.pm b/scripts/Dpkg/Changelog/Entry.pm index eb79b8f8f..e434103d5 100644 --- a/scripts/Dpkg/Changelog/Entry.pm +++ b/scripts/Dpkg/Changelog/Entry.pm @@ -214,7 +214,7 @@ Return the name of the source package associated to the changelog entry. =cut sub get_source { - return undef; + return; } =item my $ver = $entry->get_version() @@ -224,7 +224,7 @@ Return the version associated to the changelog entry. =cut sub get_version { - return undef; + return; } =item my @dists = $entry->get_distributions() @@ -234,8 +234,7 @@ Return a list of target distributions for this version. =cut sub get_distributions { - return () if wantarray; - return undef; + return; } =item $fields = $entry->get_optional_fields() @@ -256,7 +255,7 @@ Return the urgency of the associated upload. =cut sub get_urgency { - return undef; + return; } =item my $maint = $entry->get_maintainer() @@ -266,7 +265,7 @@ Return the string identifying the person who signed this changelog entry. =cut sub get_maintainer { - return undef; + return; } =item my $time = $entry->get_timestamp() @@ -276,7 +275,7 @@ Return the timestamp of the changelog entry. =cut sub get_timestamp { - return undef; + return; } =item my $str = $entry->get_dpkg_changes() diff --git a/scripts/Dpkg/Changelog/Entry/Debian.pm b/scripts/Dpkg/Changelog/Entry/Debian.pm index 64554806d..48e21ce9d 100644 --- a/scripts/Dpkg/Changelog/Entry/Debian.pm +++ b/scripts/Dpkg/Changelog/Entry/Debian.pm @@ -183,7 +183,7 @@ sub get_source { if (defined($self->{header}) and $self->{header} =~ $regex_header) { return $1; } - return undef; + return; } sub get_version { @@ -191,7 +191,7 @@ sub get_version { if (defined($self->{header}) and $self->{header} =~ $regex_header) { return Dpkg::Version->new($2); } - return undef; + return; } sub get_distributions { @@ -203,8 +203,7 @@ sub get_distributions { return @dists if wantarray; return $dists[0]; } - return () if wantarray; - return undef; + return; } sub get_optional_fields { @@ -233,7 +232,7 @@ sub get_urgency { $f->{Urgency} =~ s/\s.*$//; return lc($f->{Urgency}); } - return undef; + return; } sub get_maintainer { @@ -241,7 +240,7 @@ sub get_maintainer { if (defined($self->{trailer}) and $self->{trailer} =~ $regex_trailer) { return "$1 <$2>"; } - return undef; + return; } sub get_timestamp { @@ -249,7 +248,7 @@ sub get_timestamp { if (defined($self->{trailer}) and $self->{trailer} =~ $regex_trailer) { return $4; } - return undef; + return; } =back diff --git a/scripts/Dpkg/Changelog/Parse.pm b/scripts/Dpkg/Changelog/Parse.pm index 399033fe9..f6d7e2d53 100644 --- a/scripts/Dpkg/Changelog/Parse.pm +++ b/scripts/Dpkg/Changelog/Parse.pm @@ -156,7 +156,7 @@ sub changelog_parse { return @res; } else { return $res[0] if (@res); - return undef; + return; } } diff --git a/scripts/Dpkg/Checksums.pm b/scripts/Dpkg/Checksums.pm index fd4ba0ccc..1d4e14140 100644 --- a/scripts/Dpkg/Checksums.pm +++ b/scripts/Dpkg/Checksums.pm @@ -99,7 +99,7 @@ by the program that generates it). sub checksums_get_property($$) { my ($alg, $property) = @_; - return undef unless checksums_is_supported($alg); + return unless checksums_is_supported($alg); return $CHECKSUMS->{lc($alg)}{$property}; } @@ -315,7 +315,7 @@ sub get_checksum { return $self->{checksums}{$file} unless defined $alg; return $self->{checksums}{$file}{$alg}; } - return undef; + return; } =item $size = $ck->get_size($file) diff --git a/scripts/Dpkg/Compression.pm b/scripts/Dpkg/Compression.pm index c83fb4e25..322cb5ff3 100644 --- a/scripts/Dpkg/Compression.pm +++ b/scripts/Dpkg/Compression.pm @@ -129,9 +129,9 @@ the name of the decompression program. sub compression_get_property { my ($comp, $property) = @_; - return undef unless compression_is_supported($comp); + return unless compression_is_supported($comp); return $COMP->{$comp}{$property} if exists $COMP->{$comp}{$property}; - return undef; + return; } =item compression_guess_from_filename($filename) @@ -149,7 +149,7 @@ sub compression_guess_from_filename { return $comp; } } - return undef; + return; } =item my $comp = compression_get_default() diff --git a/scripts/Dpkg/Compression/FileHandle.pm b/scripts/Dpkg/Compression/FileHandle.pm index b0aff7b35..e7c9082c1 100644 --- a/scripts/Dpkg/Compression/FileHandle.pm +++ b/scripts/Dpkg/Compression/FileHandle.pm @@ -228,7 +228,7 @@ sub CLOSE { sub FILENO { my ($self) = shift; return *$self->{"file"}->fileno(@_) if defined *$self->{"file"}; - return undef; + return; } sub EOF { @@ -252,7 +252,7 @@ sub TELL { sub BINMODE { my ($self) = shift; return *$self->{"file"}->binmode(@_) if defined *$self->{"file"}; - return undef; + return; } ## diff --git a/scripts/Dpkg/Control/Fields.pm b/scripts/Dpkg/Control/Fields.pm index a703c45c1..56ae2f126 100644 --- a/scripts/Dpkg/Control/Fields.pm +++ b/scripts/Dpkg/Control/Fields.pm @@ -408,7 +408,7 @@ Undef is returned for non-official fields. sub field_is_allowed_in($@) { my ($field, @types) = @_; $field = field_capitalize($field); - return undef unless field_is_official($field); + return unless field_is_official($field); return 0 if not scalar(@types); foreach my $type (@types) { @@ -468,7 +468,7 @@ sub field_transfer_single($$;$) { warning(_g("unknown information field '%s' in input data in %s"), $field, $from->get_option("name") || _g("control information")); } - return undef; + return; } =item field_transfer_all($from, $to) @@ -549,9 +549,9 @@ Breaks, ...). Returns undef for fields which are not dependencies. sub field_get_dep_type($) { my $field = field_capitalize($_[0]); - return undef unless field_is_official($field); + return unless field_is_official($field); return $FIELDS{$field}{'dependency'} if exists $FIELDS{$field}{'dependency'}; - return undef; + return; } =item field_register($field, $allowed_types, %opts) diff --git a/scripts/Dpkg/Control/Hash.pm b/scripts/Dpkg/Control/Hash.pm index b14287642..38ed1edc7 100644 --- a/scripts/Dpkg/Control/Hash.pm +++ b/scripts/Dpkg/Control/Hash.pm @@ -258,7 +258,7 @@ sub find_custom_field { foreach my $key (keys %$self) { return $key if $key =~ /^X[SBC]*-\Q$name\E$/i; } - return undef; + return; } =item $c->get_custom_field($name) @@ -271,7 +271,7 @@ sub get_custom_field { my ($self, $name) = @_; my $key = $self->find_custom_field($name); return $self->{$key} if defined $key; - return undef; + return; } =item $c->save($filename) @@ -442,7 +442,7 @@ sub FETCH { my ($self, $key) = @_; $key = lc($key); return $self->[0]->{$key} if exists $self->[0]->{$key}; - return undef; + return; } sub STORE { @@ -494,7 +494,7 @@ sub NEXTKEY { $found = 1 if $_ eq $last; } } - return undef; + return; } 1; diff --git a/scripts/Dpkg/Control/Info.pm b/scripts/Dpkg/Control/Info.pm index b4009e8e2..e88bcb8f0 100644 --- a/scripts/Dpkg/Control/Info.pm +++ b/scripts/Dpkg/Control/Info.pm @@ -154,7 +154,7 @@ sub get_pkg_by_name { foreach my $pkg (@{$self->{packages}}) { return $pkg if ($pkg->{Package} eq $name); } - return undef; + return; } diff --git a/scripts/Dpkg/Deps.pm b/scripts/Dpkg/Deps.pm index c4ad92a0f..d641b7d7f 100644 --- a/scripts/Dpkg/Deps.pm +++ b/scripts/Dpkg/Deps.pm @@ -167,8 +167,8 @@ sub deps_eval_implication { my ($rel_p, $v_p, $rel_q, $v_q) = @_; # If versions are not valid, we can't decide of any implication - return undef unless defined($v_p) and $v_p->is_valid(); - return undef unless defined($v_q) and $v_q->is_valid(); + return unless defined($v_p) and $v_p->is_valid(); + return unless defined($v_q) and $v_q->is_valid(); # q wants an exact version, so p must provide that exact version. p # disproves q if q's version is outside the range enforced by p. @@ -239,7 +239,7 @@ sub deps_eval_implication { } } - return undef; + return; } =item my $dep = deps_concat(@dep_list) @@ -317,7 +317,7 @@ sub deps_parse { $options{build_dep}); if (not defined $dep_simple->{package}) { warning(_g("can't parse dependency %s"), $dep_or); - return undef; + return; } $dep_simple->{arches} = undef if not $options{use_arch}; if ($options{reduce_arch}) { @@ -344,7 +344,7 @@ sub deps_parse { foreach my $dep (@dep_list) { if ($options{union} and not $dep->isa("Dpkg::Deps::Simple")) { warning(_g("an union dependency can only contain simple dependencies")); - return undef; + return; } $dep_and->add($dep); } @@ -643,14 +643,14 @@ sub implies { my ($self, $o) = @_; if ($o->isa('Dpkg::Deps::Simple')) { # An implication is only possible on the same package - return undef if $self->{package} ne $o->{package}; + return if $self->{package} ne $o->{package}; # Our architecture set must be a superset of the architectures for # o, otherwise we can't conclude anything. - return undef unless Dpkg::Deps::_arch_is_superset($self->{arches}, $o->{arches}); + return unless Dpkg::Deps::_arch_is_superset($self->{arches}, $o->{arches}); # The arch qualifier must not forbid an implication - return undef unless + return unless Dpkg::Deps::_arch_qualifier_allows_implication($self->{archqual}, $o->{archqual}); @@ -658,7 +658,7 @@ sub implies { return 1 if not defined $o->{relation}; # If o has a version clause, we must also have one, otherwise there # can't be an implication - return undef if not defined $self->{relation}; + return if not defined $self->{relation}; return Dpkg::Deps::deps_eval_implication($self->{relation}, $self->{version}, $o->{relation}, $o->{version}); @@ -761,7 +761,7 @@ sub has_arch_restriction { sub get_evaluation { my ($self, $facts) = @_; - return undef if not defined $self->{package}; + return if not defined $self->{package}; return $facts->_evaluate_simple_dep($self); } @@ -956,7 +956,7 @@ sub implies { } return 1 if $subset; } - return undef; + return; } sub get_evaluation { @@ -1064,7 +1064,7 @@ sub implies { } return 1 if $subset; } - return undef; + return; } sub get_evaluation { @@ -1150,12 +1150,12 @@ sub output { sub implies { # Implication test are not useful on Union - return undef; + return; } sub get_evaluation { # Evaluation are not useful on Union - return undef; + return; } sub simplify_deps { @@ -1272,7 +1272,7 @@ sub check_package { sub _find_package { my ($self, $dep, $lackinfos) = @_; my ($pkg, $archqual) = ($dep->{package}, $dep->{archqual}); - return undef if not exists $self->{pkg}{$pkg}; + return if not exists $self->{pkg}{$pkg}; my $host_arch = $dep->{host_arch}; my $build_arch = $dep->{build_arch}; foreach my $p (@{$self->{pkg}{$pkg}}) { @@ -1293,7 +1293,7 @@ sub _find_package { return $p if $a eq $archqual; } } - return undef; + return; } sub _find_virtual_packages { @@ -1324,7 +1324,7 @@ sub _evaluate_simple_dep { next if defined $dep->{relation}; # Provides don't satisfy versioned deps return 1; } - return undef if $lackinfos; + return if $lackinfos; return 0; } diff --git a/scripts/Dpkg/Index.pm b/scripts/Dpkg/Index.pm index 12ca1e9ab..7dd650fd9 100644 --- a/scripts/Dpkg/Index.pm +++ b/scripts/Dpkg/Index.pm @@ -202,7 +202,7 @@ Returns the item identified by $key or undef. sub get_by_key { my ($self, $key) = @_; return $self->{'items'}{$key} if exists $self->{'items'}{$key}; - return undef; + return; } =item my @keys = $index->get_keys(%criteria) diff --git a/scripts/Dpkg/Package.pm b/scripts/Dpkg/Package.pm index b68040822..f3ed4698c 100644 --- a/scripts/Dpkg/Package.pm +++ b/scripts/Dpkg/Package.pm @@ -36,7 +36,7 @@ sub pkg_name_is_illegal($) { $name =~ m/^[0-9a-z]/o || return _g("must start with an alphanumeric character"); - return undef; + return; } 1; diff --git a/scripts/Dpkg/Path.pm b/scripts/Dpkg/Path.pm index 383bc0d00..5a8977037 100644 --- a/scripts/Dpkg/Path.pm +++ b/scripts/Dpkg/Path.pm @@ -66,7 +66,7 @@ sub get_pkg_root_dir($) { last if $file !~ m{/}; $file =~ s{/+[^/]+$}{}; } - return undef; + return; } =item relative_to_pkg_root($file) @@ -82,7 +82,7 @@ sub relative_to_pkg_root($) { $pkg_root .= "/"; return $file if ($file =~ s/^\Q$pkg_root\E//); } - return undef; + return; } =item guess_pkg_root_dir($file) @@ -112,7 +112,7 @@ sub guess_pkg_root_dir($) { $file = $parent; last if $file !~ m{/}; } - return undef; + return; } =item check_files_are_the_same($file1, $file2, $resolve_symlink) @@ -185,7 +185,7 @@ canonicalized by canonpath(). sub resolve_symlink($) { my $symlink = shift; my $content = readlink($symlink); - return undef unless defined $content; + return unless defined $content; if (File::Spec->file_name_is_absolute($content)) { return canonpath($content); } else { @@ -214,7 +214,7 @@ sub find_command($) { return "$dir/$cmd" if -x "$dir/$cmd"; } } - return undef; + return; } =item my $control_file = get_control_path($pkg, $filetype) @@ -236,7 +236,7 @@ sub get_control_path($;$) { spawn(exec => \@exec, wait_child => 1, to_string => \$control_file); chomp($control_file); if (defined $filetype) { - return undef if $control_file eq ""; + return if $control_file eq ""; return $control_file; } return () if $control_file eq ""; @@ -267,7 +267,7 @@ sub find_build_file($) { } return @files if wantarray; return $files[0] if scalar @files; - return undef; + return; } =back diff --git a/scripts/Dpkg/Shlibs.pm b/scripts/Dpkg/Shlibs.pm index 722504d5a..1a40b8f1a 100644 --- a/scripts/Dpkg/Shlibs.pm +++ b/scripts/Dpkg/Shlibs.pm @@ -127,7 +127,7 @@ sub find_library { } } } - return undef; + return; } 1; diff --git a/scripts/Dpkg/Shlibs/Objdump.pm b/scripts/Dpkg/Shlibs/Objdump.pm index e03b5e81c..5652035cb 100644 --- a/scripts/Dpkg/Shlibs/Objdump.pm +++ b/scripts/Dpkg/Shlibs/Objdump.pm @@ -66,7 +66,7 @@ sub locate_symbol { return $sym; } } - return undef; + return; } sub get_object { @@ -74,7 +74,7 @@ sub get_object { if ($self->has_object($objid)) { return $self->{objects}{$objid}; } - return undef; + return; } sub has_object { @@ -379,7 +379,7 @@ sub get_symbol { return $self->{dynsyms}{$name . '@Base'}; } } - return undef; + return; } sub get_exported_dynamic_symbols { diff --git a/scripts/Dpkg/Shlibs/Symbol.pm b/scripts/Dpkg/Shlibs/Symbol.pm index 193ee1e5d..b1d649eca 100644 --- a/scripts/Dpkg/Shlibs/Symbol.pm +++ b/scripts/Dpkg/Shlibs/Symbol.pm @@ -81,7 +81,7 @@ sub parse_tagspec { } return $rest; } - return undef; + return; } sub parse_symbolspec { @@ -346,7 +346,7 @@ sub get_pattern_matches { # and add it to the pattern matches list. sub create_pattern_match { my $self = shift; - return undef unless $self->is_pattern(); + return unless $self->is_pattern(); # Leave out 'pattern' subfield while deep-cloning my $pattern_stuff = $self->{pattern}; @@ -381,7 +381,7 @@ sub convert_to_alias { return cppfilt_demangle_cpp($rawname); } } - return undef; + return; } sub get_tagspec { diff --git a/scripts/Dpkg/Shlibs/SymbolFile.pm b/scripts/Dpkg/Shlibs/SymbolFile.pm index cb24fc5f3..7b6eb2b50 100644 --- a/scripts/Dpkg/Shlibs/SymbolFile.pm +++ b/scripts/Dpkg/Shlibs/SymbolFile.pm @@ -160,7 +160,7 @@ sub create_symbol { $symbol->initialize(arch => $self->get_arch()); return $symbol; } - return undef; + return; } sub add_symbol { @@ -376,7 +376,7 @@ sub find_matching_pattern { ( symbol => $pattern, soname => $soname ) : $pattern; } } - return (wantarray) ? () : undef; + return; } # merge_symbols($object, $minver) @@ -505,7 +505,7 @@ sub get_field { return $obj->{fields}{$name}; } } - return undef; + return; } # Tries to find a symbol like the $refsym and returns its descriptor. @@ -525,7 +525,7 @@ sub lookup_symbol { } } } - return (wantarray) ? () : undef; + return; } # Tries to find a pattern like the $refpat and returns its descriptor. @@ -561,7 +561,7 @@ sub lookup_pattern { } } } - return (wantarray) ? () : undef; + return; } # Get symbol object reference either by symbol name or by a reference object. diff --git a/scripts/Dpkg/Source/Quilt.pm b/scripts/Dpkg/Source/Quilt.pm index 543a760cd..e61331f91 100644 --- a/scripts/Dpkg/Source/Quilt.pm +++ b/scripts/Dpkg/Source/Quilt.pm @@ -118,7 +118,7 @@ sub top { my ($self) = @_; my $count = scalar @{$self->{'applied-patches'}}; return $self->{'applied-patches'}[$count - 1] if $count; - return undef; + return; } sub next { @@ -126,7 +126,7 @@ sub next { my $count_applied = scalar @{$self->{'applied-patches'}}; my $count_series = scalar @{$self->{'series'}}; return $self->{'series'}[$count_applied] if ($count_series > $count_applied); - return undef; + return; } sub push { @@ -202,7 +202,7 @@ sub get_db_version { close(VER); return $version; } - return undef; + return; } sub find_problems { @@ -215,7 +215,7 @@ sub find_problems { if (-e $series and not -f _) { return sprintf(_g("%s should be a file or non-existing"), $series); } - return undef; + return; } sub get_series_file { diff --git a/scripts/Dpkg/Vendor.pm b/scripts/Dpkg/Vendor.pm index e61818e31..e3ec1679c 100644 --- a/scripts/Dpkg/Vendor.pm +++ b/scripts/Dpkg/Vendor.pm @@ -72,7 +72,7 @@ if there's no file for the given vendor. sub get_vendor_info(;$) { my $vendor = shift || "default"; my $file = get_vendor_file($vendor); - return undef unless $file; + return unless $file; my $fields = Dpkg::Control::Hash->new(); $fields->load($file) || error(_g("%s is empty"), $file); return $fields; @@ -114,7 +114,7 @@ sub get_current_vendor() { } $f = get_vendor_info(); return $f->{'Vendor'} if defined $f; - return undef; + return; } =item $object = Dpkg::Vendor::get_vendor_object($name) diff --git a/scripts/Dpkg/Vendor/Default.pm b/scripts/Dpkg/Vendor/Default.pm index ee2d495b4..4bc44c211 100644 --- a/scripts/Dpkg/Vendor/Default.pm +++ b/scripts/Dpkg/Vendor/Default.pm @@ -126,8 +126,7 @@ sub run_hook { } # Default return value for unknown/unimplemented hooks - return () if wantarray; - return undef; + return; } =back diff --git a/scripts/Dpkg/Version.pm b/scripts/Dpkg/Version.pm index a113c5815..d4944c80e 100644 --- a/scripts/Dpkg/Version.pm +++ b/scripts/Dpkg/Version.pm @@ -84,7 +84,7 @@ sub new { $ver = "$ver" if ref($ver); # Try to stringify objects if ($opts{'check'}) { - return undef unless version_check($ver); + return unless version_check($ver); } my $self = {}; diff --git a/scripts/dpkg-shlibdeps.pl b/scripts/dpkg-shlibdeps.pl index f4cc571c2..fc570bc3c 100755 --- a/scripts/dpkg-shlibdeps.pl +++ b/scripts/dpkg-shlibdeps.pl @@ -587,7 +587,7 @@ sub get_min_version_from_deps { { return $dep->{version}; } - return undef; + return; } else { my $res; foreach my $subdep ($dep->get_deps()) { @@ -737,7 +737,7 @@ sub find_symbols_file { return $file; } } - return undef; + return; } sub symfile_has_soname { @@ -814,7 +814,7 @@ sub my_find_library { $file = find_library($lib, \@RPATH, $format, ""); return $file if defined($file); - return undef; + return; } my %cached_pkgmatch = (); diff --git a/test/100_critic.t b/test/100_critic.t index eac78ca60..8c768276f 100644 --- a/test/100_critic.t +++ b/test/100_critic.t @@ -58,6 +58,7 @@ my @policies = qw( Modules::RequireEndWithOne Modules::RequireExplicitPackage Modules::RequireFilenameMatchesPackage + Subroutines::ProhibitExplicitReturnUndef TestingAndDebugging::ProhibitNoStrict TestingAndDebugging::ProhibitNoWarnings ValuesAndExpressions::ProhibitComplexVersion |