File Coverage

blib/lib/CPAN/FindDependencies/Dependency.pm
Criterion Covered Total %
statement 13 13 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod 5 5 100.0
total 26 26 100.0


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