The following commit has been merged in the master branch:
commit 46bc7b2ee075f73231cee90446248ce43d69eda3
Author: Guillem Jover <[email protected]>
Date:   Tue Feb 19 21:22:11 2013 +0100

    Dpkg::Shlibs::Objdump: Add an optional objdump argument to get_format
    
    This gets rid of the localized $OBJDUMP variable, by explicitly passing
    the overriden value to the recursive call.
    
    Fixes Variables::ProhibitLocalVars.

diff --git a/scripts/Dpkg/Shlibs/Objdump.pm b/scripts/Dpkg/Shlibs/Objdump.pm
index 563bea3..f8977cc 100644
--- a/scripts/Dpkg/Shlibs/Objdump.pm
+++ b/scripts/Dpkg/Shlibs/Objdump.pm
@@ -85,16 +85,18 @@ sub has_object {
 {
     my %format; # Cache of result
     sub get_format {
-       my ($file) = @_;
+       my ($file, $objdump) = @_;
+
+       $objdump //= $OBJDUMP;
 
        if (exists $format{$file}) {
            return $format{$file};
        } else {
            my ($output, %opts, $pid, $res);
-           if ($OBJDUMP ne 'objdump') {
+           if ($objdump ne 'objdump') {
                $opts{error_to_file} = '/dev/null';
            }
-           $pid = spawn(exec => [ $OBJDUMP, '-a', '--', $file ],
+           $pid = spawn(exec => [ $objdump, '-a', '--', $file ],
                         env => { LC_ALL => 'C' },
                         to_pipe => \$output, %opts);
            while (<$output>) {
@@ -108,9 +110,8 @@ sub has_object {
            close($output);
            wait_child($pid, nocheck => 1);
            if ($?) {
-               subprocerr('objdump') if $OBJDUMP eq 'objdump';
-               local $OBJDUMP = 'objdump';
-               $res = get_format($file);
+               subprocerr('objdump') if $objdump eq 'objdump';
+               $res = get_format($file, 'objdump');
            }
            return $res;
        }
diff --git a/test/100_critic.t b/test/100_critic.t
index 39d52ec..1ffee1c 100644
--- a/test/100_critic.t
+++ b/test/100_critic.t
@@ -100,6 +100,7 @@ my @policies = qw(
     ValuesAndExpressions::RequireUpperCaseHeredocTerminator
     Variables::ProhibitAugmentedAssignmentInDeclaration
     Variables::ProhibitConditionalDeclarations
+    Variables::ProhibitLocalVars
     Variables::ProhibitPerl4PackageNames
     Variables::ProhibitUnusedVariables
     Variables::ProtectPrivateVars

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to