File Coverage

blib/lib/RPerl/DataStructure/Hash_cpp.pm
Criterion Covered Total %
statement 41 42 97.6
branch 6 10 60.0
condition 2 3 66.6
subroutine 11 11 100.0
pod n/a
total 60 66 90.9


line stmt bran cond sub pod time code
1             # [[[ HEADER ]]]
2             package RPerl::DataStructure::Hash_cpp;
3 1     1   1276 use strict;
  1         2  
  1         25  
4 1     1   5 use warnings;
  1         7  
  1         24  
5 1     1   4 use RPerl::AfterSubclass;
  1         2  
  1         123  
6             our $VERSION = 0.005_000;
7              
8             # [[[ CRITICS ]]]
9             ## no critic qw(ProhibitStringyEval) # SYSTEM DEFAULT 1: allow eval()
10              
11             # [[[ INCLUDES ]]]
12 1     1   5 use RPerl::Inline;
  1         3  
  1         189  
13              
14             # [[[ SUBROUTINES ]]]
15             sub cpp_load {
16 2     2   5 { my void::method $RETURN_TYPE };
  2         4  
17 2         4 my $need_load_cpp = 0;
18 2 100 66     11 if ( ( exists $main::{'RPerl__DataStructure__Hash__MODE_ID'} )
19 1         7 and ( defined &{ $main::{'RPerl__DataStructure__Hash__MODE_ID'} } ) )
20             {
21             # RPerl::diag("in Hash_cpp::cpp_load, RPerl__DataStructure__Hash__MODE_ID() exists & defined\n");
22             # RPerl::diag(q{in Hash_cpp::cpp_load, have RPerl__DataStructure__Hash__MODE_ID() retval = '} . main::RPerl__DataStructure__Hash__MODE_ID() . "'\n");
23 1 50       5 if ( $RPerl::MODES->{main::RPerl__DataStructure__Hash__MODE_ID()}->{ops} ne 'CPP' ) {
24 1         2 $need_load_cpp = 1;
25             }
26             }
27             else {
28             # RPerl::diag("in Hash_cpp::cpp_load, RPerl__DataStructure__Hash__MODE_ID() does not exist or undefined\n");
29 1         5 $need_load_cpp = 1;
30             }
31              
32 2 50       8 if ($need_load_cpp) {
33              
34             # RPerl::diag("in Hash_cpp::cpp_load, need load CPP code\n");
35              
36 2         7 my $eval_string = <<"EOF";
37             package main;
38             use RPerl::Inline;
39             BEGIN { RPerl::diag("[[[ BEGIN 'use Inline' STAGE for 'RPerl/DataStructure/Hash.cpp' ]]]\n" x 0); }
40             use Inline (CPP => '$main::INCLUDE_PATH' . '/RPerl/DataStructure/Hash.cpp', \%RPerl::Inline::ARGS);
41             RPerl::diag("[[[ END 'use Inline' STAGE for 'RPerl/DataStructure/Hash.cpp' ]]]\n" x 0);
42             1;
43             EOF
44              
45 2         15 $RPerl::Inline::ARGS{ccflagsex} = $RPerl::Inline::CCFLAGSEX . $RPerl::TYPES_CCFLAG . rperltypessizes::type_integer_native_ccflag() . rperltypessizes::type_number_native_ccflag();
46 2         7 $RPerl::Inline::ARGS{cppflags} = $RPerl::TYPES_CCFLAG . rperltypessizes::type_integer_native_ccflag() . rperltypessizes::type_number_native_ccflag();
47             # RPerl::diag("in Hash_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");
48              
49 1 50   1   7 eval $eval_string or croak( $OS_ERROR . "\n" . $EVAL_ERROR );
  1     1   3  
  1     1   54  
  1     1   7  
  1     1   5  
  1     1   2  
  1         11  
  1         11  
  1         3  
  1         47  
  1         8  
  1         6  
  1         2  
  1         15  
  2         138  
50 2 50       13 if ($EVAL_ERROR) { croak($EVAL_ERROR); }
  0         0  
51             }
52              
53             # else { RPerl::diag("in Hash_cpp::cpp_load(), CPP already loaded, DOING NOTHING\n"); }
54 2         18 return;
55             }
56              
57             1; # end of package