blib/lib/Alien/libwebsockets.pm

filter: Statementstmt 96.0% 24 / 25 Branchbran 57.1% 8 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 84.0% 37 / 44 SCAR 22.5
CC
9
Cov
82%
has_extensions
10.3
BEGIN
1.0
BEGIN
1.0
CRAP 9.5
↑ Summary alienfile »
1 package Alien::libwebsockets;
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use parent 'Alien::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 our $VERSION = '0.04';
7  
8 sub has_extensions {
9 1 ▶ my ($class) = @_;
Subroutine has_extensions: called CC=9 SCAR=23.3
Pod documented
10 1 my @libs = $class->dynamic_libs;
11 1 ▶ return 0 unless @libs;
Branch: 1 branch
BranchTrueFalseTotal
unless @libs 0 1 1
12  
13 1 ▶ my @nm_cmd = $^O eq 'darwin' ? ('nm', '-gU')
Branch: 2 branches
BranchTrueFalseTotal
$^O eq 'darwin' ? : 0 1 1
$^O =~ /^(?:freebsd|openbsd|netbsd|dragonfly)$/ ? : 0 1 1
14 : $^O =~ /^(?:freebsd|openbsd|netbsd|dragonfly)$/ ? ('nm', '-g')
15 : ('nm', '-D');
16  
17 1 foreach my $lib (@libs) {
18 1 my $found = 0;
19 1 ▶ if (open my $fh, '-|', @nm_cmd, $lib) {
Branch: 1 branch
BranchTrueFalseTotal
if (open my $fh, "-|", @nm_cmd, $lib) 1 0 1
20 1 ▶ while (<$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 482 0 482
21 482 ▶ if (/lws_extension_callback_pm_deflate/) { $found = 1; last }
Branch: 1 branch
BranchTrueFalseTotal
if (/lws_extension_callback_pm_deflate/) 1 481 482
22 }
23 1 close $fh;
24 }
25 1 ▶ return 1 if $found;
Branch: 1 branch
BranchTrueFalseTotal
if $found 1 0 1
26 }
27  
28 0 return 0;
29 }
30  
31 2 1;
32  
33 __END__
↑ Summary alienfile »