blib/lib/Intertangle/API/Glib.pm

filter: Statementstmt 83.3% 10 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 87.5% 14 / 16 CC 1 SCAR 0.7
CC
1
Cov
83%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
↑ Summary
1 1 ▶use Modern::Perl;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 package Intertangle::API::Glib;
3 # ABSTRACT: Helper for using Glib
4 $Intertangle::API::Glib::VERSION = '0.001';
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 0 ▶use Glib;
Subroutine BEGIN: called CC=1 SCAR=2.6
9 use List::MoreUtils qw(zip);
10  
11 sub Inline {
12 return unless $_[-1] eq 'C';
13  
14 require ExtUtils::Depends;
15 my $ref = ExtUtils::Depends::load('Glib');
16  
17 my $config = +{ map { uc($_) => $ref->{$_} } qw(inc libs typemaps) };
18  
19 # Set CCFLAGSEX to the value of INC directly. This is to get around some
20 # shell parsing / quoting bug that causes INC to quote parts that
21 # should not be quoted.
22 $config->{CCFLAGSEX} = delete $config->{INC};
23  
24 # Add the Glib.pm dynamic library to access the `gperl` symbols. This
25 # is usually handled automatically by simply loading Glib.pm via
26 # DynaLoader, but on Windows, it must be explicitly linked.
27 if( $^O eq 'MSWin32') {
28 my %dl_module_to_so = zip( @DynaLoader::dl_modules, @DynaLoader::dl_shared_objects );
29 $config->{MYEXTLIB} = $dl_module_to_so{Glib};
30 }
31  
32 $config->{AUTO_INCLUDE} = <<C;
33 #include <gperl.h>
34 C
35  
36 $config;
37 }
38  
39 1;
40  
41 __END__
↑ Summary