r36337 - /trunk/dh-make-perl/lib/Debian/Dependencies.pm
dmn at users.alioth.debian.org
dmn at users.alioth.debian.org
Sun May 24 20:09:28 UTC 2009
Author: dmn
Date: Sun May 24 20:09:15 2009
New Revision: 36337
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=36337
Log:
Dependencies: add has() method
Modified:
trunk/dh-make-perl/lib/Debian/Dependencies.pm
Modified: trunk/dh-make-perl/lib/Debian/Dependencies.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/Debian/Dependencies.pm?rev=36337&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/Debian/Dependencies.pm (original)
+++ trunk/dh-make-perl/lib/Debian/Dependencies.pm Sun May 24 20:09:15 2009
@@ -205,6 +205,29 @@
return @removed;
}
+=item has(dep)
+
+Return true if the dependency list contains given dependency. In other words,
+this returns true if the list of dependencies guarantees that the given
+dependency will be satisfied. For example, I<foo, bar> satisfies I<foo>, but
+not I<foo (>= 5)>.
+
+=cut
+
+sub has {
+ my( $self, $dep ) = @_;
+
+ $dep = Debian::Dependency->new($dep)
+ unless eval { $dep->isa('Debian::Dependency') };
+
+ for( @$self ) {
+ return 1
+ if $_->satisfies($dep);
+ }
+
+ return 0;
+}
+
=item prune()
This method is deprecated. If you want to sort the dependency list, either call L</sort> or use normal perl sorting stuff on the dereferenced array.
More information about the Pkg-perl-cvs-commits
mailing list