[Bps-public-commit] r10145 - in Test-Dependencies/trunk: lib/Test lib/Test/Dependencies
zev at bestpractical.com
zev at bestpractical.com
Thu Dec 27 03:33:20 EST 2007
Author: zev
Date: Thu Dec 27 03:33:19 2007
New Revision: 10145
Modified:
Test-Dependencies/trunk/ (props changed)
Test-Dependencies/trunk/lib/Test/Dependencies.pm
Test-Dependencies/trunk/lib/Test/Dependencies/Heavy.pm
Log:
r10363 at cliffjumper: zev | 2007-12-27 02:52:03 -0500
* return an array ref from get_modules_used_in_file so that undef can be an error
Modified: Test-Dependencies/trunk/lib/Test/Dependencies.pm
==============================================================================
--- Test-Dependencies/trunk/lib/Test/Dependencies.pm (original)
+++ Test-Dependencies/trunk/lib/Test/Dependencies.pm Thu Dec 27 03:33:19 2007
@@ -93,7 +93,11 @@
my @modules;
foreach my $file (sort @sourcefiles) {
- push @modules, get_modules_used_in_file($file);
+ my $ret = get_modules_used_in_file($file);
+ if (! defined $ret) {
+ die "Could not determine modules used in '$file'";
+ }
+ push @modules, @$ret;
}
return @modules;
}
Modified: Test-Dependencies/trunk/lib/Test/Dependencies/Heavy.pm
==============================================================================
--- Test-Dependencies/trunk/lib/Test/Dependencies/Heavy.pm (original)
+++ Test-Dependencies/trunk/lib/Test/Dependencies/Heavy.pm Thu Dec 27 03:33:19 2007
@@ -25,9 +25,10 @@
=head2 get_modules_used_in_file
-Returns all the modules that the passed file uses. This style
-determines this list by actually compiling the code. This could be a
-dangerous operation if the file does bad things in BEGIN blocks!
+Returns an array ref of all the modules that the passed file uses.
+This style determines this list by actually compiling the code. This
+could be a dangerous operation if the file does bad things in BEGIN
+blocks!
=cut
@@ -39,8 +40,7 @@
my $taint = _taint_flag($file);
my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) =
run(command => [$perl, $taint, '-MO=PerlReq', $file]);
- die "Could not compile '$file': error code: $error_code"
- unless $success;
+ return undef unless $success;
# for some reason IPC::Run doesn't always split lines correctly
my @lines;
@@ -53,7 +53,7 @@
# path2mod sucks, but the mod2path that B::PerlReq uses sucks, too
$deps{path2mod($1)}++;
}
- return keys %deps;
+ return [keys %deps];
}
sub _taint_flag {
More information about the Bps-public-commit
mailing list