blib/lib/Inline/MakeMaker.pm untested

filter: Statementstmt 0.0% 0 / 31 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 9 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 58 CC 6 SCAR 31.7
CC
6
Cov
0%
WriteMakefile
42.0
WriteInlineMakefile
2.0
BEGIN
2.0
CRAP 23.8
1 package Inline::MakeMaker;
2  
3 $Inline::MakeMaker::VERSION = '0.54';
4 $Inline::MakeMaker::VERSION = eval $Inline::MakeMaker::VERSION;
5 @EXPORT = qw(WriteMakefile WriteInlineMakefile);
6  
7 use strict;
8 use base 'Exporter';
9 use ExtUtils::MakeMaker();
10 use Carp;
11  
12 sub WriteInlineMakefile {
13 # warn <<END;
14 #
15 #Inline::MakeMaker::WriteInlineMakefile() is deprecated as of Inline-0.44.
16 #Inline::MakeMaker::WriteMakefile() should be used instead.
17 #
18 #END
19 goto &WriteMakefile;
20 }
21  
22 sub WriteMakefile {
23 my %args = @_;
24 my $name = $args{NAME}
25 or croak "Inline::MakeMaker::WriteMakefile requires the NAME parameter\n";
26 my $object = (split(/::/, $name))[-1];
27 my $version = '';
28  
29 croak <<END unless (defined $args{VERSION} or defined $args{VERSION_FROM});
30 Inline::MakeMaker::WriteMakefile requires either the VERSION or VERSION_FROM
31 parameter.
32 END
33 if (defined $args{VERSION}) {
34 $version = $args{VERSION};
35 }
36 else {
37 $version = ExtUtils::MM_Unix->parse_version($args{VERSION_FROM})
38 or croak "Can't determine version for $name\n";
39 }
40 croak <<END unless $version =~ /^\d\.\d\d$/;
41 Invalid version '$version' for $name.
42 Must be of the form '#.##'. (For instance '1.23')
43 END
44  
45 # Provide a convenience rule to clean up Inline's messes
46 $args{clean} = { FILES => "_Inline $object.inl" }
47 unless defined $args{clean};
48 # Add Inline to the dependencies
49 $args{PREREQ_PM}{Inline} = '0.44' unless defined $args{PREREQ_PM}{Inline};
50  
51 &ExtUtils::MakeMaker::WriteMakefile(%args);
52  
53 open MAKEFILE, '>> Makefile'
54 or croak "Inline::MakeMaker::WriteMakefile can't append to Makefile:\n$!";
55  
56 print MAKEFILE <<MAKEFILE;
57 # Well, not quite. Inline::MakeMaker is adding this:
58  
59 # --- MakeMaker inline section:
60  
61 $object.inl : \$(TO_INST_PM)
62 \$(PERL) -Mblib -MInline=NOISY,_INSTALL_ -M$name -e1 $version \$(INST_ARCHLIB)
63  
64 pure_all :: $object.inl
65  
66 # The End is here.
67 MAKEFILE
68  
69 close MAKEFILE;
70 }
71  
72 1;