blib/lib/Inline/MakePdlppInstallable.pm untested

filter: Statementstmt 0.0% 0 / 25 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 3 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 1 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 44 CC 8 SCAR 42.8
CC
8
Cov
0%
install
72.0
CRAP 72.0
1 package Inline::MakePdlppInstallable;
2  
3 # just a dummy package
4  
5 package # have to break this up so the
6 # CPAN indexer doesn't barf
7 Inline;
8  
9 #==============================================================================
10 # override the original Inline::install method
11 # to allow Inline::Pdlpp code to be installed
12 #
13 # this is a hack !
14 #
15 # we put the modified function into its own little file
16 # to keep the runtime impact at a minimum
17 #
18 # use as follows in modules containing inlined PDL::PP code:
19 #
20 # use Inline::MakePdlppInstallable;
21 # use Inline Pdlpp => ....
22 #
23 # hopefully Inline will establishe a proper mechanism soon
24 # to allow installation of non-C modules -- at least Brian Ingerson
25 # promised to put it on the TODO list
26 #==============================================================================
27  
28 # copied verbatim from Inline 0.43 apart from language_id check below
29 sub install {
30 my ($module, $DIRECTORY);
31 my $o = shift;
32  
33 # print STDERR "in redefined Inline::install\n";
34 croak M64_install_not_c($o->{API}{language_id})
35 unless uc($o->{API}{language_id}) eq 'C' ||
36 uc($o->{API}{language_id}) eq 'PDLPP'; # also allow Pdlpp !
37 croak M36_usage_install_main()
38 if ($o->{API}{pkg} eq 'main');
39 croak M37_usage_install_auto()
40 if $o->{CONFIG}{AUTONAME};
41 croak M38_usage_install_name()
42 unless $o->{CONFIG}{NAME};
43 croak M39_usage_install_version()
44 unless $o->{CONFIG}{VERSION};
45 croak M40_usage_install_badname($o->{CONFIG}{NAME}, $o->{API}{pkg})
46 unless $o->{CONFIG}{NAME} eq $o->{API}{pkg};
47 # $o->{CONFIG}{NAME} =~ /^$o->{API}{pkg}::\w(\w|::)+$/
48 # );
49  
50 my ($mod_name, $mod_ver, $ext_name, $ext_ver) =
51 ($o->{API}{pkg}, $ARGV[0], @{$o->{CONFIG}}{qw(NAME VERSION)});
52 croak M41_usage_install_version_mismatch($mod_name, $mod_ver,
53 $ext_name, $ext_ver)
54 unless ($mod_ver eq $ext_ver);
55 $o->{INLINE}{INST_ARCHLIB} = $ARGV[1];
56  
57 $o->{API}{version} = $o->{CONFIG}{VERSION};
58 $o->{API}{module} = $o->{CONFIG}{NAME};
59 my @modparts = split(/::/,$o->{API}{module});
60 $o->{API}{modfname} = $modparts[-1];
61 $o->{API}{modpname} = join('/',@modparts);
62 $o->{API}{suffix} = $o->{INLINE}{ILSM_suffix};
63 $o->{API}{build_dir} = ( $o->{INLINE}{DIRECTORY} . '/build/' .
64 $o->{API}{modpname}
65 );
66 $o->{API}{directory} = $o->{INLINE}{DIRECTORY};
67 my $cwd = Cwd::cwd();
68 $o->{API}{install_lib} = "$cwd/$o->{INLINE}{INST_ARCHLIB}";
69 $o->{API}{location} = "$o->{API}{install_lib}/auto/" .
70 "$o->{API}{modpname}/$o->{API}{modfname}.$o->{INLINE}{ILSM_suffix}";
71 unshift @::INC, $o->{API}{install_lib};
72 $o->{INLINE}{object_ready} = 0;
73 }
74  
75  
76 1;