Skip Menu |

This queue is for tickets about the Module-Used CPAN distribution.

Report information
The Basics
Id: 79108
Status: resolved
Priority: 0/
Queue: Module-Used

People
Owner: Nobody in particular
Requestors: NEILB [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: v1.2.0
Fixed in: v1.3.0



Subject: Add function modules_used_by_modules()
I've added a function to your module, modules_used_by_modules(). This takes a list of module names, determines the path to the module, then calls modules_used_by_files(). I've added a testcase to your testsuite, and added documentation. My changes can be seen on github: https://github.com/neilbowers/Module-Used
Subject: Re: [rt.cpan.org #79108] Add function modules_used_by_modules()
Date: Tue, 21 Aug 2012 06:47:27 -0500
To: bug-Module-Used [...] rt.cpan.org
From: Elliot Shank <elliotjs [...] cpan.org>
On 8/21/12 4:45 AM, Neil_Bowers via RT wrote: Show quoted text
> My changes can be seen on github:
Would you be kind enough to provide that as a patch? Some of us don't want to touch git with a ten foot polecat.
Show quoted text
> Would you be kind enough to provide that as a patch?
Sure, here it is. Changes to Build.PL, t/b_modules_used.t, and lib/Module/Used.pm
Subject: module-used.patch
*** Build.PL.orig 2008-12-08 06:06:29.000000000 +0000 --- Build.PL 2012-08-21 14:58:46.000000000 +0100 *************** *** 63,68 **** --- 63,69 ---- 'Exporter' => 5.57, 'File::Next' => 1.02, 'PPI::Document' => 1.203, + 'Module::Path' => 0.01, 'Readonly' => 1.03, 'strict' => 0, 'utf8' => 0, *** b_modules_used.t.orig 2008-12-08 06:06:29.000000000 +0000 --- b_modules_used.t 2012-08-21 14:59:40.000000000 +0100 *************** *** 7,16 **** use version; our $VERSION = qv('v1.1.0'); ! use Module::Used qw< modules_used_in_string modules_used_in_files >; use Test::Deep qw< bag cmp_deeply >; ! use Test::More tests => 21; { --- 7,20 ---- use version; our $VERSION = qv('v1.1.0'); ! use Module::Used qw< ! modules_used_in_string ! modules_used_in_files ! modules_used_in_modules ! >; use Test::Deep qw< bag cmp_deeply >; ! use Test::More tests => 22; { *************** *** 72,77 **** --- 76,87 ---- $code, ); + cmp_deeply( + [ modules_used_in_modules( 'Config' ) ], + bag( qw< strict warnings vars > ), + 'Config', + ); + $code = q<use base 'A', "B", q[C], qq[D::E];>; cmp_deeply( *** Used.pm.orig 2008-12-08 06:06:29.000000000 +0000 --- Used.pm 2012-08-21 15:01:02.000000000 +0100 *************** *** 10,15 **** --- 10,16 ---- use English qw<-no_match_vars>; use Readonly; + use Module::Path qw< module_path >; use Exporter qw< import >; *************** *** 18,23 **** --- 19,25 ---- modules_used_in_files modules_used_in_string modules_used_in_document + modules_used_in_modules >; our %EXPORT_TAGS = ( all => [@EXPORT_OK], *************** *** 40,45 **** --- 42,61 ---- return keys %modules; } # end modules_used_in_files() + sub modules_used_in_modules { + my @modules = @_; + my @files = (); + my $fullpath; + + foreach my $module (@modules) { + $fullpath = module_path($module) + or die qq<Could not find module "$module" in \@INC\n>; + + push(@files, $fullpath); + } + + return modules_used_in_files(@files); + } # end modules_used_in_modules() sub modules_used_in_string { my ($string) = @_; *************** *** 258,263 **** --- 274,285 ---- C<die>s if there is a problem reading a file. + =item C< modules_used_in_modules( @module_names ) > + + Return a list of modules used in the specified modules. + + C<die>s if there any of the modules weren't found in C<@INC>. + =item C< modules_used_in_string( $string ) > *************** *** 306,312 **** =head1 DEPENDENCIES ! L<PPI::Document> =head1 INCOMPATIBILITIES --- 328,335 ---- =head1 DEPENDENCIES ! L<PPI::Document>, ! L<Module::Path> =head1 INCOMPATIBILITIES
Subject: Re: [rt.cpan.org #79108] Add function modules_used_by_modules()
Date: Mon, 27 Aug 2012 21:25:48 -0500
To: bug-Module-Used [...] rt.cpan.org
From: Elliot Shank <elliotjs [...] cpan.org>
Thanks for this. Released as v1.3.0.