File Coverage

blib/lib/RPerl/DataStructure/Hash_cpp.pm
Criterion Covered Total %
statement 26 26 100.0
branch n/a
condition n/a
subroutine 10 10 100.0
pod n/a
total 36 36 100.0


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