File Coverage

blib/lib/Module/Install/Inline.pm
Criterion Covered Total %
statement 12 25 48.0
branch 0 8 0.0
condition 0 3 0.0
subroutine 4 6 66.6
pod 0 2 0.0
total 16 44 36.3


line stmt bran cond sub pod time code
1             package Module::Install::Inline;
2              
3 1     1   816 use strict;
  1         2  
  1         22  
4 1     1   3 use Module::Install::Base ();
  1         1  
  1         15  
5              
6 1     1   3 use vars qw{$VERSION @ISA $ISCORE};
  1         1  
  1         52  
7             BEGIN {
8 1     1   2 $VERSION = '1.18';
9 1         6 @ISA = 'Module::Install::Base';
10 1         219 $ISCORE = 1;
11             }
12              
13 0     0 0   sub Inline { $_[0] }
14              
15             sub write {
16 0     0 0   my $self = shift;
17 0 0 0       my $name = $self->module_name || $self->name
18             or die "Please set name() before calling &Inline->write\n";
19 0           $name =~ s/-/::/g;
20 0 0         my $object = (split(/::/, $name))[-1] or return;
21 0 0         my $version = $self->version
22             or die "Please set version() or version_from() before calling &Inline->write\n";
23              
24 0 0         $version =~ /^\d\.\d\d$/ or die <<"END_MESSAGE";
25             Invalid version '$version' for $name.
26             Must be of the form '#.##'. (For instance '1.23')
27             END_MESSAGE
28              
29 0           $self->clean_files('_Inline', "$object.inl");
30 0           $self->build_requires('Inline' => 0.44); # XXX: check for existing? yagni?
31              
32 0           my $class = ref($self);
33 0           my $prefix = $self->_top->{prefix};
34 0           $self->postamble(<<"MAKEFILE");
35             # --- $class section:
36              
37             .SUFFIXES: .pm .inl
38              
39             .pm.inl:
40             \t\$(PERL) -I$prefix "-Mblib" "-MInline=NOISY,_INSTALL_" "-M$name" -e1 $version \$(INST_ARCHLIB)
41              
42             pure_all :: $object.inl
43              
44             MAKEFILE
45              
46 0           $self->Makefile->write;
47             }
48              
49             1;