example/inc/Module/Install/External.pm

filter: Statementstmt 47.0% 16 / 34 Branchbran 16.6% 1 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 2 totaltotal 45.8% 22 / 48 CC 4 SCAR 16.2
CC
4
Cov
42%
requires_external_bin
12.0
requires_external_cc
2.7
BEGIN
1.0
CRAP 5.0
« example/inc/Module/Install/Can.pm ↑ Summary example/inc/Module/Install/Base.pm »
1 #line 1
2 package Module::Install::External;
3  
4 # Provides dependency declarations for external non-Perl things
5 1 ▶ 
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 use Module::Install::Base ();
8 1 ▶ 
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use vars qw{$VERSION $ISCORE @ISA};
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 BEGIN {
11 1 $VERSION = '0.91';
12 1 $ISCORE = 1;
13 @ISA = qw{Module::Install::Base};
14 }
15 1 ▶ 
Subroutine requires_external_cc: called CC=2 SCAR=9.9
Pod undocumented
16 1 sub requires_external_cc {
17 my $self = shift;
18  
19 1 ▶ # We need a C compiler, use the can_cc method for this
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->can_cc) 0 1 1
20 0 unless ( $self->can_cc ) {
21 0 print "Unresolvable missing external dependency.\n";
22 0 print "This package requires a C compiler.\n";
23 0 print STDERR "NA: Unable to build distribution on this platform.\n";
24 exit(0);
25 }
26  
27 # Unlike some of the other modules, while we need to specify a
28 # C compiler as a dep, it needs to be a build-time dependency.
29 1  
30 1;
31 }
32 0 ▶ 
Subroutine requires_external_bin: not called CC=3 SCAR=24.8
Pod undocumented
33 0 sub requires_external_bin {
34 0 ▶ my ($self, $bin, $version) = @_;
Branch: 1 branch
BranchTrueFalseTotal
if ($version) 0 0 0
35 0 if ( $version ) {
36 die "requires_external_bin does not support versions yet";
37 }
38  
39 # Load the package containing can_run early,
40 0 # to avoid breaking the message below.
41 $self->load('can_run');
42  
43 0 # Locate the bin
44 0 print "Locating required external dependency bin:$bin...";
45 0 ▶ my $found_bin = $self->can_run( $bin );
Branch: 1 branch
BranchTrueFalseTotal
if ($found_bin) { } 0 0 0
46 0 if ( $found_bin ) {
47 print " found at $found_bin.\n";
48 0 } else {
49 0 print " missing.\n";
50 0 print "Unresolvable missing external dependency.\n";
51 0 print "Please install '$bin' seperately and try again.\n";
52 0 print STDERR "NA: Unable to build distribution on this platform.\n";
53 exit(0);
54 }
55  
56 # Once we have some way to specify external deps, do it here.
57 # In the mean time, continue as normal.
58 0  
59 1;
60 }
61 1  
62 1;
63  
64 __END__
« example/inc/Module/Install/Can.pm ↑ Summary example/inc/Module/Install/Base.pm »