File Coverage

blib/lib/CPAN/FindDependencies/Dependency.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 9 9 100.0
pod 5 5 100.0
total 30 30 100.0


line stmt bran cond sub pod time code
1             package CPAN::FindDependencies::Dependency;
2              
3             require CPAN::FindDependencies;
4              
5 11     11   87 use strict;
  11         32  
  11         405  
6 11     11   66 use warnings;
  11         24  
  11         390  
7              
8 11     11   69 use vars qw($VERSION);
  11         29  
  11         2495  
9              
10             $VERSION = '2.99_01';
11              
12             =head1 NAME
13              
14             CPAN::FindDependencies::Dependency - object representing a module dependency
15              
16             =head1 SYNOPSIS
17              
18             my @dependencies = CPAN::FindDependencies::finddeps("CPAN");
19             foreach my $dep (@dependencies) {
20             print ' ' x $dep->depth();
21             print $dep->name().' (dist: '.$dep->distribution().', mod ver: '.$dep->version().")\n";
22             }
23              
24             =head1 METHODS
25              
26             The following read-only accessors are available. You will note that
27             there is no public constructor and no mutators. Objects will be
28             created by the CPAN::FindDependencies module.
29              
30             =cut
31              
32             sub _new {
33 52     52   604 my($class, %opts) = @_;
34 52         161382 bless \%opts, $class;
35             }
36              
37             =head2 name
38              
39             The name of the module
40              
41             =cut
42              
43 51     51 1 1730 sub name { $_[0]->{cpanmodule} }
44              
45             =head2 distribution
46              
47             The name of the distribution containing the module
48              
49             =cut
50              
51             sub distribution {
52 48     48 1 1236 $_[0]->{distribution}->prefix();
53             }
54              
55             =head2 version
56              
57             The minimum required version (if specified) of the module
58              
59             =cut
60              
61             sub version {
62             $_[0]->{version}
63 5     5 1 87 }
64              
65             =head2 depth
66              
67             How deeply nested this module is in the dependency tree
68              
69             =cut
70              
71 48     48 1 184 sub depth { return $_[0]->{depth} }
72              
73             =head2 warning
74              
75             If any warnings were generated while processing the module (even
76             if suppressed), this will return them.
77              
78             =cut
79              
80 48     48 1 554 sub warning { return $_[0]->{warning} }
81              
82             =head1 BUGS/LIMITATIONS
83              
84             None known
85              
86             =head1 FEEDBACK
87              
88             I welcome feedback about my code, including constructive criticism
89             and bug reports. The best bug reports include files that I can add
90             to the test suite, which fail with the current code in my git repo and
91             will pass once I've fixed the bug
92              
93             =head1 SOURCE CODE REPOSITORY
94              
95             L<git://github.com/DrHyde/perl-modules-CPAN-FindDependencies.git>
96              
97             =head1 SEE ALSO
98              
99             L<CPAN::FindDepdendencies>
100              
101             L<CPAN>
102              
103             L<http://deps.cpantesters.org/>
104              
105             =head1 AUTHOR, LICENCE and COPYRIGHT
106              
107             Copyright 2007 David Cantrell E<lt>F<david@cantrell.org.uk>E<gt>
108              
109             This software is free-as-in-speech software, and may be used,
110             distributed, and modified under the terms of either the GNU
111             General Public Licence version 2 or the Artistic Licence. It's
112             up to you which one you use. The full text of the licences can
113             be found in the files GPL2.txt and ARTISTIC.txt, respectively.
114              
115             =head1 CONSPIRACY
116              
117             This module is also free-as-in-mason software.
118              
119             =cut
120              
121             1;