File Coverage

blib/lib/ExtUtils/Builder/Binary.pm
Criterion Covered Total %
statement 19 22 86.3
branch 2 4 50.0
condition n/a
subroutine 6 7 85.7
pod 0 1 0.0
total 27 34 79.4


line stmt bran cond sub pod time code
1             package ExtUtils::Builder::Binary;
2             $ExtUtils::Builder::Binary::VERSION = '0.036';
3 4     4   1748 use strict;
  4         8  
  4         150  
4 4     4   19 use warnings;
  4         17  
  4         170  
5              
6 4     4   23 use Carp qw//;
  4         22  
  4         99  
7 4     4   586 use ExtUtils::Builder::Util qw/function/;
  4         10920  
  4         1210  
8              
9             my %allowed_types = map { ($_ => 1) } qw/shared-library static-library loadable-object executable/;
10              
11             sub _init {
12 15     15   44 my ($self, %args) = @_;
13 15 50       70 my $type = $args{type} or Carp::croak('No type given');
14 15 50       49 $allowed_types{$type} or Carp::croak("$type is not an allowed linkage type");
15 15         44 $self->{type} = $type;
16 15         69 return;
17             }
18              
19             sub type {
20 29     29 0 49 my $self = shift;
21 29         132 return $self->{type};
22             }
23              
24             sub _mkdir_for {
25 0     0     my ($self, $file) = @_;
26 0           my $dirname = File::Basename::dirname($file);
27 0           return function(
28             module => 'File::Path',
29             function => 'make_path',
30             exports => 'explicit',
31             arguments => [ $dirname ],
32             message => "mkdir $dirname",
33             );
34             }
35             1;
36              
37             # ABSTRACT: Helper role for classes producing binary objects
38              
39             __END__