r29449 - /trunk/dh-make-perl/lib/Debian/Dependency.pm
dmn at users.alioth.debian.org
dmn at users.alioth.debian.org
Wed Jan 7 21:05:40 UTC 2009
Author: dmn
Date: Wed Jan 7 21:05:37 2009
New Revision: 29449
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=29449
Log:
Dependency: overload '+'
Modified:
trunk/dh-make-perl/lib/Debian/Dependency.pm
Modified: trunk/dh-make-perl/lib/Debian/Dependency.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/Debian/Dependency.pm?rev=29449&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/Debian/Dependency.pm (original)
+++ trunk/dh-make-perl/lib/Debian/Dependency.pm Wed Jan 7 21:05:37 2009
@@ -27,12 +27,17 @@
# stringification
print "$d" # 'perl (>= 5.10)'
+ # 'adding'
+ $deps = $dep1 + $dep2;
+ $deps = $dep1 + 'foo (>= 1.23)'
+
=cut
use base qw(Class::Accessor);
__PACKAGE__->mk_accessors(qw( pkg ver rel ));
-use overload '""' => \&_stringify;
+use overload '""' => \&_stringify,
+ '+' => \&_add;
=head2 CLASS_METHODS
@@ -81,6 +86,16 @@
? $self->pkg . ' (' . $self->rel . ' ' . $self->ver . ')'
: $self->pkg
);
+}
+
+sub _add {
+ my $left = shift;
+ my $right = shift;
+ my $mode = shift;
+
+ confess "cannot += Dependency. put Dependencies instance on the left instead" unless defined($mode);
+
+ return bless( [ $left ], 'Debian::Dependencies' ) + $right;
}
=item parse()
More information about the Pkg-perl-cvs-commits
mailing list