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
*** 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