r53101 - /trunk/dh-make-perl/lib/DhMakePerl.pm

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Sat Feb 20 21:20:45 UTC 2010


Author: dmn
Date: Sat Feb 20 21:20:39 2010
New Revision: 53101

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=53101
Log:
convert $priority to object accessor

Modified:
    trunk/dh-make-perl/lib/DhMakePerl.pm

Modified: trunk/dh-make-perl/lib/DhMakePerl.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/DhMakePerl.pm?rev=53101&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/DhMakePerl.pm (original)
+++ trunk/dh-make-perl/lib/DhMakePerl.pm Sat Feb 20 21:20:39 2010
@@ -7,7 +7,8 @@
 use base 'Class::Accessor';
 use Pod::Usage;
 
-__PACKAGE__->mk_accessors(qw( cfg apt_contents main_dir debian_dir meta ));
+__PACKAGE__->mk_accessors(
+    qw( cfg apt_contents main_dir debian_dir meta priority ));
 
 =head1 NAME
 
@@ -71,7 +72,7 @@
 # TODO:
 # * get more info from the package (maybe using CPAN methods)
 
-my ($priority,
+my (
     $section,             $depends,       $bdepends,
     $bdependsi,           $maintainer,    $arch,
     $closes,              $date,
@@ -80,13 +81,29 @@
 our %overrides;
 
 use constant debstdversion => '3.8.4';
-$priority      = 'optional';
 $section       = 'perl';
 $depends       = Debian::Dependencies->new('${perl:Depends}');
 
 # this is the version in 'oldstable'. No much point on depending on something
 # older
 use constant oldest_perl_version => '5.8.8-7';
+
+our %DEFAULTS = (
+    priority => 'optional',
+);
+
+sub new {
+    my $class = shift;
+    $class = ref($class) if ref($class);
+
+    my $self = $class->SUPER::new(@_);
+
+    while( my( $k, $v ) = each %DEFAULTS ) {
+        $self->$k($v) unless defined $self->$k;
+    }
+
+    return $self;
+}
 
 $bdependsi = Debian::Dependencies->new("perl");
 $arch      = 'all';
@@ -1511,7 +1528,7 @@
 
     $fh->print("Source: $srcname\n");
     $fh->print("Section: $section\n");
-    $fh->print("Priority: $priority\n");
+    $fh->printf( "Priority: %s\n", $self->priority );
     local $Text::Wrap::break     = ', ';
     local $Text::Wrap::separator = ",\n";
     $fh->print( wrap( '', ' ', "Build-Depends: $bdepends\n" ) ) if $bdepends;
@@ -1947,7 +1964,7 @@
             $val = $self->get_override_val( $data, $subkey, 'section' )
         )
         );
-    $priority = $val
+    $self->priority($val)
         if (
         defined(
             $val = $self->get_override_val( $data, $subkey, 'priority' )




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