r27859 - /trunk/dh-make-perl/dh-make-perl

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Sun Dec 7 17:13:54 UTC 2008


Author: dmn
Date: Sun Dec  7 17:13:52 2008
New Revision: 27859

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=27859
Log:
add Dep::List class

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=27859&op=diff
==============================================================================
--- trunk/dh-make-perl/dh-make-perl (original)
+++ trunk/dh-make-perl/dh-make-perl Sun Dec  7 17:13:52 2008
@@ -440,6 +440,37 @@
 
 1;
 
+# List of Dep objects
+# Overrides the stringification operator so that one can use Dep::List
+# and a string, consisting of list of dependencies simultaneously
+#
+# my $dl = Dep::List->new('perl, libfoo-perl (>= 3.4)');
+# print $dl->[1]->ver;      # 3.4
+# print $dl->[1];           # libfoo-perl (>= 3.4)
+# print $dl;                # perl, libfoo-perl (>= 3.4)
+
+package Dep::List;
+
+use overload
+    '""'   => \&stringify;
+
+sub new {
+    my ( $class, $val ) = @_;
+
+    my $self = bless [], $class;
+
+    if ( defined($val) ) {
+        @{$self} = map( Dep->new($_), split( /\s*,\s*/, $val ) );
+    }
+}
+
+sub stringify {
+    my $self = shift;
+
+    return join( ', ', @$self );
+}
+
+1;
 ######################################################################
 # Main dh-make-perl starts here, don't look any further!
 package main;




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