[dh-make-perl] 02/03: replace 'options' and 'commands' constants with initialized lexical variables

Damyan Ivanov dmn at moszumanska.debian.org
Mon Jun 30 12:17:21 UTC 2014


This is an automated email from the git hooks/post-receive script.

dmn pushed a commit to branch master
in repository dh-make-perl.

commit 57f728dba4f1d9a12ada1dd9f4e7afd4eb3cbe71
Author: Damyan Ivanov <dmn at debian.org>
Date:   Mon Jun 30 12:16:10 2014 +0000

    replace 'options' and 'commands' constants with initialized lexical variables
    
    these aren't overridden anywhere, and having plain variables is easier
    anyway. fixes POD test failures with Perl 5.20 (see #752917)
---
 lib/DhMakePerl/Config.pm | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/lib/DhMakePerl/Config.pm b/lib/DhMakePerl/Config.pm
index 57fa7ba..e8cd119 100644
--- a/lib/DhMakePerl/Config.pm
+++ b/lib/DhMakePerl/Config.pm
@@ -14,7 +14,7 @@ DhMakePerl::Config - dh-make-perl configuration class
 use base 'Class::Accessor';
 use Dpkg::Source::Package;
 
-use constant options => (
+my @OPTIONS = (
     'apt-contents-dir=s',
     'arch=s',          'backups!',
     'basepkgs=s',
@@ -40,12 +40,12 @@ use constant options => (
     'verbose!',        'version=s',
 );
 
-use constant commands =>
+my @COMMANDS =
     ( 'make', 'refresh|R', 'refresh-cache', 'dump-config', 'locate', 'help' );
 
 __PACKAGE__->mk_accessors(
     do {
-        my @opts = ( __PACKAGE__->options, __PACKAGE__->commands );
+        my @opts = ( @OPTIONS, @COMMANDS );
         for (@opts) {
             s/[=:!|].*//;
             s/-/_/g;
@@ -142,7 +142,7 @@ sub parse_command_line_options {
     # run below.
     Getopt::Long::Configure( qw( pass_through no_auto_abbrev no_ignore_case ) );
     my %opts;
-    GetOptions( \%opts, $self->options, )
+    GetOptions( \%opts, @OPTIONS )
         or die "Error parsing command-line options\n";
 
     # Make CPAN happy, make the user happy: Be more tolerant!
@@ -172,7 +172,7 @@ sub parse_command_line_options {
     # see what are we told to do
     %opts = ();
     Getopt::Long::Configure('no_pass_through');
-    GetOptions( \%opts, $self->commands )
+    GetOptions( \%opts, @COMMANDS )
         or die "Error parsing command-line options\n";
 
     if (%opts) {
@@ -182,7 +182,7 @@ sub parse_command_line_options {
     }
     else {
         my %cmds;
-        for( $self->commands ) {
+        for (@COMMANDS) {
             my $c = $_;
             $c =~ s/\|.+//;     # strip short alternatives
             $cmds{$c} = 1;
@@ -200,7 +200,7 @@ sub parse_command_line_options {
 
     if ( scalar( keys %opts ) > 1 ) {
         die "Only one of " .
-            map( $_, $self->commands ) . " can be specified\n";
+            map( $_, @COMMANDS ) . " can be specified\n";
     }
 
     $self->command( ( keys %opts )[0] );
@@ -253,7 +253,7 @@ sub parse_config_file {
             "Error parsing $fn: config-file is not allowed in the configuration file"
             if $yaml->{'config-file'};
 
-        for ( $self->options ) {
+        for (@OPTIONS) {
              ( my $key = $_ ) =~ s/[!=|].*//;
 
             next unless exists $yaml->{$key};
@@ -288,7 +288,7 @@ sub dump_config {
     my %hash;
     tie %hash, 'Tie::IxHash';
 
-    for my $opt ( $self->options ) {
+    for my $opt (@OPTIONS) {
         $opt =~ s/[=!|].*//;
         ( my $field = $opt ) =~ s/-/_/g;
         $hash{$opt} = $self->$field;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/dh-make-perl.git



More information about the Pkg-perl-cvs-commits mailing list