File Coverage

lib/UR/Namespace/Command/Test/Compile.pm
Criterion Covered Total %
statement 9 22 40.9
branch 0 2 0.0
condition n/a
subroutine 3 7 42.8
pod 0 4 0.0
total 12 35 34.2


line stmt bran cond sub pod time code
1              
2             package UR::Namespace::Command::Test::Compile;
3              
4 1     1   23 use strict;
  1         1  
  1         30  
5 1     1   3 use warnings;
  1         1  
  1         28  
6 1     1   4 use UR;
  1         1  
  1         7  
7             our $VERSION = "0.46"; # UR $VERSION;
8              
9             UR::Object::Type->define(
10             class_name => __PACKAGE__,
11             is => "UR::Namespace::Command::RunsOnModulesInTree",
12             );
13              
14             sub help_brief {
15 0     0 0   "Attempts to compile each module in the namespace in its own process."
16             }
17              
18             sub help_synopsis {
19             return <
20             ur test complie
21              
22             ur test compile Some::Module Some::Other::Module
23              
24             ur test complile Some/Module.pm Some/Other/Mod*.pm
25             EOS
26 0     0 0   }
27              
28             sub help_detail {
29             return <
30             This command runs "perl -c" on each module in a separate process and aggregates results.
31             Running with --verbose will list specific modules instead of just a summary.
32              
33             Try "ur test use" for a faster evaluation of whether your software tree is broken. :)
34             EOS
35 0     0 0   }
36              
37             sub for_each_module_file {
38 0     0 0   my $self = shift;
39 0           my $module_file = shift;
40 0           my $lib_path = $self->lib_path;
41 0           my @response = `cd $lib_path; perl -I $lib_path -c $module_file 2>&1`;
42 0 0         if (grep { $_ eq "$module_file syntax OK\n" } @response) {
  0            
43 0           print "$module_file syntax OK\n"
44             }
45             else {
46 0           chomp @response;
47 0           print "$module_file syntax FAILED\n"
48             . join("\n\t",@response), "\n";
49             }
50 0           return 1;
51             }
52              
53             1;
54