File Coverage

blib/lib/Alien/libwebsockets.pm
Criterion Covered Total %
statement 22 23 95.6
branch 7 12 58.3
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 34 40 85.0


line stmt bran cond sub pod time code
1             package Alien::libwebsockets;
2 2     2   469058 use strict;
  2         5  
  2         86  
3 2     2   9 use warnings;
  2         4  
  2         172  
4 2     2   32 use parent 'Alien::Base';
  2         4  
  2         18  
5              
6             our $VERSION = '0.03';
7              
8             sub has_extensions {
9 1     1 1 259403 my ($class) = @_;
10 1         110 my @libs = $class->dynamic_libs;
11 1 50       10297 return 0 unless @libs;
12              
13 1 50       10 my @nm_cmd = $^O eq 'darwin' ? ('nm', '-gU')
    50          
14             : $^O =~ /^(?:freebsd|openbsd|netbsd|dragonfly)$/ ? ('nm', '-g')
15             : ('nm', '-D');
16              
17 1         3 foreach my $lib (@libs) {
18 1         2 my $found = 0;
19 1 50       5158 if (open my $fh, '-|', @nm_cmd, $lib) {
20 1         5243 while (<$fh>) {
21 482 100       1519 if (/lws_extension_callback_pm_deflate/) { $found = 1; last }
  1         14  
  1         20  
22             }
23 1         47 close $fh;
24             }
25 1 50       62 return 1 if $found;
26             }
27              
28 0           return 0;
29             }
30              
31             1;
32              
33             __END__