blib/lib/Perl/Structure/GSLMatrix_cpp.pm untested

filter: Statementstmt 0.0% 0 / 35 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 57 CC 5 SCAR 28.7
CC
5
Cov
0%
cpp_load
30.0
BEGIN
2.0
BEGIN
2.0
CRAP 17.6
1 # [[[ HEADER ]]]
2 package Perl::Structure::GSLMatrix_cpp;
3 use strict;
4 use warnings;
5 use Perl::Types;
6 our $VERSION = 0.002_000;
7  
8 # [[[ CRITICS ]]]
9 ## no critic qw(ProhibitStringyEval) # SYSTEM DEFAULT 1: allow eval()
10  
11 # [[[ INCLUDES ]]]
12 use Perl::Inline;
13  
14 # [[[ SUBROUTINES ]]]
15 sub cpp_load {
16 { my void $RETURN_TYPE };
17 my $need_load_cpp = 0;
18 if ( ( exists $main::{'Perl__Structure__GSLMatrix__MODE_ID'} )
19 and ( defined &{ $main::{'Perl__Structure__GSLMatrix__MODE_ID'} } ) )
20 {
21 # Perl::diag("in GSLMatrix_cpp::cpp_load, Perl__Structure__GSLMatrix__MODE_ID() exists & defined\n");
22 # Perl::diag(q{in GSLMatrix_cpp::cpp_load, have Perl__Structure__GSLMatrix__MODE_ID() retval = '} . main::Perl__Structure__GSLMatrix__MODE_ID() . "'\n");
23 if ( $Perl::MODES->{main::Perl__Structure__GSLMatrix__MODE_ID()}->{ops} ne 'CPP' ) {
24 $need_load_cpp = 1;
25 }
26 }
27 else {
28 # Perl::diag("in GSLMatrix_cpp::cpp_load, Perl__Structure__GSLMatrix__MODE_ID() does not exist or undefined\n");
29 $need_load_cpp = 1;
30 }
31  
32 if ($need_load_cpp) {
33  
34 # Perl::diag("in GSLMatrix_cpp::cpp_load, need load CPP code\n");
35  
36 my $eval_string = <<"EOF";
37 package main;
38 use Perl::Inline;
39 BEGIN { Perl::diag("[[[ BEGIN 'use Inline' STAGE for 'Perl/Structure/GSLMatrix.cpp' ]]]\n" x 1); }
40 use Inline (CPP => '$Perl::INCLUDE_PATH' . '/Perl/Structure/GSLMatrix.cpp', \%Perl::Inline::ARGS);
41 Perl::diag("[[[ END 'use Inline' STAGE for 'Perl/Structure/GSLMatrix.cpp' ]]]\n" x 1);
42 1;
43 EOF
44  
45 $Perl::Inline::ARGS{ccflagsex} = $Perl::Inline::CCFLAGSEX . $Perl::TYPES_CCFLAG . perltypessizes::type_integer_native_ccflag() . perltypessizes::type_number_native_ccflag();
46 $Perl::Inline::ARGS{cppflags} = $Perl::TYPES_CCFLAG . perltypessizes::type_integer_native_ccflag() . perltypessizes::type_number_native_ccflag();
47 $Perl::Inline::ARGS{libs} = '-lgsl'; # enable GSL support
48 $Perl::Inline::ARGS{inc} .= ' -I' . $Perl::Inline::gsl_include_dir; # enable GSL support
49 $Perl::Inline::ARGS{auto_include} = [ @{ $Perl::Inline::ARGS{auto_include} }, '#include <gsl_matrix.h>' ]; # enable GSL support
50
51 # Perl::diag("in GSLMatrix_cpp::cpp_load(), CPP not yet loaded, about to call eval() on \$eval_string =\n<<< BEGIN EVAL STRING>>>\n" . $eval_string . "<<< END EVAL STRING >>>\n");
52 # Perl::diag("in GSLMatrix_cpp::cpp_load(), CPP not yet loaded, have \%Perl::Inline::ARGS =\n" . Dumper(\%Perl::Inline::ARGS) . "\n");
53 # Perl::diag("in GSLMatrix_cpp::cpp_load(), CPP not yet loaded, have \$Perl::TYPES_CCFLAG = '" . $Perl::TYPES_CCFLAG . "'\n");
54  
55 eval $eval_string or croak( $OS_ERROR . "\n" . $EVAL_ERROR );
56 if ($EVAL_ERROR) { croak($EVAL_ERROR); }
57 }
58  
59 # else { Perl::diag("in GSLMatrix_cpp::cpp_load(), CPP already loaded, DOING NOTHING\n"); }
60 return;
61 }
62  
63 1; # end of package