Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CPAN-FindDependencies CPAN distribution.

Report information
The Basics
Id: 49538
Status: resolved
Priority: 0/
Queue: CPAN-FindDependencies

People
Owner: Nobody in particular
Requestors: bpphillips+bitcard [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: required dependency version
It would be nice if the required version (if specified) would be available as a method on the CPAN::Dependencies::Dependency object. It looks like it would be as simple as adding it to the CPAN::FindDependencies::Dependency::_new() call as (version => $version) since it's being passed into _finddeps_uncached already. See attached patch file for proposed change (including docs and tests)
Subject: 0001-Add-version-method-to-CPAN-FindDependencies-Depend.patch
From a6ec04a0d7f9415de447a5c4adf2a9b9ef183f60 Mon Sep 17 00:00:00 2001 From: Brian Phillips <bphillips@digitalriver.com> Date: Tue, 8 Sep 2009 21:45:18 -0500 Subject: [PATCH] Add version method to CPAN::FindDependencies::Dependency This allows the user to keep track of the required version as specified (if at all) in the META.YML file of each module in the dependency graph. --- lib/CPAN/FindDependencies.pm | 1 + lib/CPAN/FindDependencies/Dependency.pm | 12 +++++++++++- t/01-dependencies.t | 12 ++++++------ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/lib/CPAN/FindDependencies.pm b/lib/CPAN/FindDependencies.pm index e60498a..c5c391f 100644 --- a/lib/CPAN/FindDependencies.pm +++ b/lib/CPAN/FindDependencies.pm @@ -316,6 +316,7 @@ sub _finddeps_uncached { depth => $depth, cpanmodule => $target, p => $p, + version => $version || 0, ($warning ? (warning => $warning) : ()) ), ($depth != $opts->{maxdepth}) ? (map { diff --git a/lib/CPAN/FindDependencies/Dependency.pm b/lib/CPAN/FindDependencies/Dependency.pm index 40df719..f3f320b 100644 --- a/lib/CPAN/FindDependencies/Dependency.pm +++ b/lib/CPAN/FindDependencies/Dependency.pm @@ -17,7 +17,7 @@ CPAN::FindDependencies::Dependency - object representing a module dependency my @dependencies = CPAN::FindDependencies::finddeps("CPAN"); foreach my $dep (@dependencies) { print ' ' x $dep->depth(); - print $dep->name().' ('.$dep->distribution().")\n"; + print $dep->name().' ('.$dep->distribution().", ".$dep->version().")\n"; } =head1 METHODS @@ -51,6 +51,16 @@ sub distribution { $_[0]->{p}->package($_[0]->name())->distribution()->prefix(); } +=head2 version + +The minimum required version (if specified) of the the module + +=cut + +sub version { + $_[0]->{version}; +} + =head2 depth How deeply nested this module is in the dependency tree diff --git a/t/01-dependencies.t b/t/01-dependencies.t index ab5beed..0d8d5b9 100644 --- a/t/01-dependencies.t +++ b/t/01-dependencies.t @@ -36,7 +36,7 @@ is_deeply( is_deeply( { map { - $_->name() => [$_->depth(), $_->distribution(), $_->warning()?1:0] + $_->name() => [$_->depth(), $_->distribution(), $_->warning()?1:0, $_->version] } finddeps( 'CPAN::FindDependencies', '02packages' => 't/cache/CPAN-FindDependencies-1.1/02packages.details.txt.gz', @@ -46,11 +46,11 @@ is_deeply( ) }, { - 'CPAN::FindDependencies' => [0, 'D/DC/DCANTRELL/CPAN-FindDependencies-1.1.tar.gz',0], - 'LWP::UserAgent' => [1, 'G/GA/GAAS/libwww-perl-5.808.tar.gz', 1], - 'YAML' => [1, 'I/IN/INGY/YAML-0.66.tar.gz',0], - 'CPAN' => [1, 'A/AN/ANDK/CPAN-1.9205.tar.gz',0], - 'Test::Harness' => [2, 'A/AN/ANDYA/Test-Harness-3.03.tar.gz',0], + 'CPAN::FindDependencies' => [0, 'D/DC/DCANTRELL/CPAN-FindDependencies-1.1.tar.gz',0,'1.1'], + 'LWP::UserAgent' => [1, 'G/GA/GAAS/libwww-perl-5.808.tar.gz', 1, '2.032'], + 'YAML' => [1, 'I/IN/INGY/YAML-0.66.tar.gz',0,'0.61'], + 'CPAN' => [1, 'A/AN/ANDK/CPAN-1.9205.tar.gz',0,'1.9102'], + 'Test::Harness' => [2, 'A/AN/ANDYA/Test-Harness-3.03.tar.gz',0,'2.62'], }, "Dependencies calculated OK for perl 5.8.8" ); -- 1.6.2.4
On Tue Sep 08 22:57:06 2009, bphillips wrote: Show quoted text
> It would be nice if the required version (if specified) would be > available as a method on the CPAN::Dependencies::Dependency object.
I second that. I'd like to be able to know enough to skip installing modules which are currently installed with a "good enough" version. At the moment the ->distribution attribute always seems to indicate the latest release on CPAN, and believing that would mean that I need to upgrade every dependency that isn't on the cutting edge.
Thanks, applied. WIll be in version 2.33 which is on its way to the CPAN now.