r28069 - /trunk/dh-make-perl/lib/Debian/Dependency.pm
dmn at users.alioth.debian.org
dmn at users.alioth.debian.org
Thu Dec 11 14:27:12 UTC 2008
Author: dmn
Date: Thu Dec 11 14:27:10 2008
New Revision: 28069
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=28069
Log:
Dependency: add POD
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=28069&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/Debian/Dependency.pm (original)
+++ trunk/dh-make-perl/lib/Debian/Dependency.pm Thu Dec 11 14:27:10 2008
@@ -9,16 +9,20 @@
=head1 SYNOPSIS
- my $d = Dep->new( 'perl' ); # simple dependency
- my $d = Dep->new('perl (>= 5.10)'); # also parses a single argument
- my $d = Dep->new( 'perl', '5.10' ); # dependency with a version
- my $d = Dep->new( 'perl', '>=', '5.10' );
- # dependency with version and relation
+ # simple dependency
+ my $d = Debian::Dependency->new( 'perl' );
+ # also parses a single argument
+ my $d = Debian::Dependency->new('perl (>= 5.10)');
+ # dependency with a version
+ my $d = Debian::Dependency->new( 'perl', '5.10' );
+ # dependency with version and relation
+ my $d = Debian::Dependency->new( 'perl', '>=', '5.10' );
+
print $d->pkg; # 'perl'
print $d->ver; # '5.10
- # for people who like to type much
- my $d = Dep->new( { pkg => 'perl', ver => '5.10' } );
+ # for people who like to type much
+ my $d = Debian::Dependency->new( { pkg => 'perl', ver => '5.10' } );
# stringification
print "$d" # 'perl (>= 5.10)'
@@ -30,6 +34,28 @@
use overload
'""' => \&_stringify;
+
+=head2 CLASS_METHODS
+
+=over 4
+
+=item new()
+
+=item new( { pkg => 'package', rel => '>=', ver => '1.9' } )
+
+Construct new instance. If a reference is passed as an argument, it must be a
+hashref and is passed to L<Class::Accessor>.
+
+If a single argument is given, the construction is passed to the C<parse>
+constructor.
+
+Two arguments are interpreted as package name and version. The relation is
+assumed to be '>='.
+
+Three arguments are interpreted as package name, relation and version.
+
+=cut
+
sub new {
my $class = shift;
$class = ref($class) if ref($class);
@@ -57,6 +83,24 @@
: $self->pkg
);
}
+
+=item parse()
+
+Takes a single string argument and parses it.
+
+Examples:
+
+=over
+
+=item perl
+
+=item perl (>= 5.8)
+
+=item libversion-perl (<< 3.4)
+
+=back
+
+=cut
sub parse {
my ( $class, $str ) = @_;
@@ -97,6 +141,38 @@
1;
+=back
+
+=head2 FIELDS
+
+=over
+
+=item pkg
+
+Contains the name of the package that is depended upon
+
+=item rel
+
+Contains the relation of the dependency. May be any of '<<', '<=', '==', '>='
+or '>>'. Default is '>='.
+
+=item ver
+
+Contains the version of the package the dependency is about.
+
+=back
+
+C<rel> and C<ver> are either both present or both missing.
+
+Examples
+
+ print $dep->pkg;
+ $dep->ver('3.4');
+
+=head1 SEE ALSO
+
+L<Debian::Dependencies>
+
=head1 AUTHOR
=over 4
More information about the Pkg-perl-cvs-commits
mailing list