The following commit has been merged in the master branch:
commit b299dad5ad3eb8bbcf75b0891f87744399e75574
Author: Guillem Jover <guil...@debian.org>
Date:   Sun Jun 14 19:57:05 2009 +0200

    Dpkg::ErrorHandling: Add new report_options()
    
    Set report options via this new function instead of directly exporting
    private variables.

diff --git a/scripts/Dpkg/ErrorHandling.pm b/scripts/Dpkg/ErrorHandling.pm
index 877663e..6996692 100644
--- a/scripts/Dpkg/ErrorHandling.pm
+++ b/scripts/Dpkg/ErrorHandling.pm
@@ -4,11 +4,20 @@ use Dpkg;
 use Dpkg::Gettext;
 
 use base qw(Exporter);
-our @EXPORT = qw(info warning error errormsg
+our @EXPORT = qw(report_options info warning error errormsg
                  syserr internerr subprocerr usageerr syntaxerr);
-our @EXPORT_OK = qw(report unknown $quiet_warnings);
+our @EXPORT_OK = qw(report unknown);
 
-our $quiet_warnings = 0;
+my $quiet_warnings = 0;
+
+sub report_options
+{
+    my (%options) = @_;
+
+    if (exists $options{quiet_warnings}) {
+        $quiet_warnings = $options{quiet_warnings};
+    }
+}
 
 sub report(@)
 {
diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl
index b461a3a..03cf0b5 100755
--- a/scripts/dpkg-source.pl
+++ b/scripts/dpkg-source.pl
@@ -6,7 +6,7 @@ use warnings;
 
 use Dpkg;
 use Dpkg::Gettext;
-use Dpkg::ErrorHandling qw(:DEFAULT unknown $quiet_warnings);
+use Dpkg::ErrorHandling qw(:DEFAULT unknown);
 use Dpkg::Arch qw(debarch_eq);
 use Dpkg::Deps qw(@src_dep_fields %dep_field_type);
 use Dpkg::Fields qw(:list capit);
@@ -115,7 +115,7 @@ while (@ARGV && $ARGV[0] =~ m/^-/) {
         # Deprecated option
         warning(_g("-E and -W are deprecated, they are without effect"));
     } elsif (m/^-q$/) {
-        $quiet_warnings = 1;
+        report_options(quiet_warnings => 1);
         $options{'quiet'} = 1;
     } elsif (m/^--$/) {
         last;
diff --git a/scripts/t/100_Dpkg_Version.t b/scripts/t/100_Dpkg_Version.t
index c98565f..5d3beed 100644
--- a/scripts/t/100_Dpkg_Version.t
+++ b/scripts/t/100_Dpkg_Version.t
@@ -1,13 +1,13 @@
 # -*- mode: cperl;-*-
 
 use Test::More;
-use Dpkg::ErrorHandling qw($quiet_warnings);
-
-$quiet_warnings = 1;
+use Dpkg::ErrorHandling;
 
 use strict;
 use warnings;
 
+report_options(quiet_warnings => 1);
+
 my @tests = <DATA>;
 my @ops = ("<", "<<", "lt",
           "<=", "le",
diff --git a/scripts/t/300_Dpkg_BuildOptions.t 
b/scripts/t/300_Dpkg_BuildOptions.t
index dc43acd..ca1838d 100644
--- a/scripts/t/300_Dpkg_BuildOptions.t
+++ b/scripts/t/300_Dpkg_BuildOptions.t
@@ -1,6 +1,7 @@
 # -*- mode: cperl;-*-
 
 use Test::More tests => 6;
+use Dpkg::ErrorHandling;
 
 use strict;
 use warnings;
@@ -11,7 +12,7 @@ use_ok('Dpkg::BuildOptions');
     no warnings;
     # Disable warnings related to invalid values fed during
     # the tests
-    $Dpkg::ErrorHandling::quiet_warnings = 1;
+    report_options(quiet_warnings => 1);
 }
 
 $ENV{DEB_BUILD_OPTIONS} = 'noopt foonostripbar parallel=3 bazNOCHECK';

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to