r27295 - /trunk/dh-make-perl/dh-make-perl

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Wed Nov 26 12:21:49 UTC 2008


Author: dmn
Date: Wed Nov 26 12:21:44 2008
New Revision: 27295

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=27295
Log:
add simple Dep class for storing package-version dependency pair

stringifies into '$pkg (>= $ver)'

Modified:
    trunk/dh-make-perl/dh-make-perl

Modified: trunk/dh-make-perl/dh-make-perl
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/dh-make-perl?rev=27295&op=diff
==============================================================================
--- trunk/dh-make-perl/dh-make-perl (original)
+++ trunk/dh-make-perl/dh-make-perl Wed Nov 26 12:21:44 2008
@@ -245,6 +245,36 @@
     } @matches;
 
     return $matches[0];
+}
+
+1;
+
+package Dep;
+
+use base qw(Class::Accessor);
+__PACKAGE__->mk_accessors(qw(pkg ver));
+
+use overload
+    '""'    => \&stringify;
+sub new {
+    my $class = shift;
+    $class = ref($class) if ref($class);
+
+    return (
+        ref( $_[0] )
+        ? $class->SUPER::new(@_)
+        : $class->SUPER::new( { pkg => $_[0], ver => $_[1] } )
+    );
+}
+
+sub stringify {
+    my $self = shift;
+
+    return (
+        $self->ver
+        ? $self->pkg . ' (>= ' . $self->ver . ')'
+        : $self->pkg
+    );
 }
 
 1;




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