blib/lib/WWW/Wappalyzer.pm

filter: Statementstmt 99.4% 176 / 177 Branchbran 88.5% 85 / 96 Conditioncond 91.1% 31 / 34 MC/DCmcdc 78.9% 15 / 19 Subroutinesub 94.1% 16 / 17 Podpod 100% 3 / 3 totaltotal 94.2% 326 / 346 SCAR 42.9
CC
72
Cov
95%
detect
39.2
_load_categories
12.8
_process_app_clues
12.0
CRAP 72.6
↑ Summary
1 package WWW::Wappalyzer;
2  
3 3 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶use base qw ( Exporter );
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 our @EXPORT_OK = qw( detect get_categories add_clues_file );
9  
10 3 ▶use lib::abs;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶use JSON qw();
Subroutine BEGIN: called CC=1 SCAR=0.0
12 3 ▶use Regexp::Parser;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 3 my %_categories;
15 3 my @_clues_file_list = ( lib::abs::path( './apps.json' ) );
16  
17 # List of multi per web page application categories
18 3 my %MULTIPLE_APP_CATS = map { $_ => 1 } qw(
19 widgets analytics javascript-frameworks video-players
20 font-scripts miscellaneous advertising-networks payment-processors
21 );
22  
23 =head1 NAME
24  
25 WWW::Wappalyzer - Perl port of Wappalyzer (http://wappalyzer.com)
26  
27 =head1 DESCRIPTION
28  
29 Uncovers the technologies used on websites: detects content management systems, web shops,
30 web servers, JavaScript frameworks, analytics tools and many more.
31  
32 Lacks 'version', 'implies', 'excludes' support of original Wappalyzer in favour of speed.
33  
34 Clues: L<https://github.com/AliasIO/Wappalyzer/blob/master/src/apps.json>
35  
36 More info on Wappalyzer: L<https://github.com/AliasIO/Wappalyzer>
37  
38 =cut
39  
40 3 our $VERSION = '0.21';
41  
42 =head1 SYNOPSIS
43  
44 use WWW::Wappalyzer;
45 use LWP::UserAgent;
46 use List::Util 'pairmap';
47  
48 my $response = LWP::UserAgent->new->get( 'http://www.drupal.org' );
49 my %detected = WWW::Wappalyzer::detect(
50 html => $response->decoded_content,
51 headers => { pairmap { $a => [ $response->headers->header($a) ] } $response->headers->flatten },
52 );
53  
54 # %detected = (
55 # 'web-servers' => [ 'Apache' ],
56 # 'cms' => [ 'Drupal' ],
57 # 'cache-tools' => [ 'Varnish' ],
58 # 'analytics' => [ 'Google Analytics' ],
59 # 'operating-systems' => [ 'CentOS' ]
60 # );
61  
62 =head1 EXPORT
63  
64 None by default.
65  
66 =head1 SUBROUTINES/METHODS
67  
68 =head2 detect
69  
70 my %detected = detect( %params )
71  
72 Tries to detect CMS, framework, etc for given html code, http headers, url.
73  
74 Available parameters:
75  
76 html - HTML code of web page.
77  
78 headers - Hash ref to http headers list. The value may be a plain string or a array ref
79 of strings for a multi-valued field.
80  
81 url - URL of web page.
82  
83 cats - Array ref to a list of trying categories, defaults to all categories;
84 Less cats => less cpu usage.
85  
86 Returns the hash of detected applications by category:
87  
88 (
89 cms => [ 'Joomla' ],
90 'javascript-frameworks' => [ 'jQuery', 'jQuery UI' ],
91 )
92  
93 =cut
94  
95 sub detect {
96 13 ▶ my %params = @_;
Subroutine detect: called CC=39 SCAR=36.7
Pod documented
97  
98 13 ▶ return () unless $params{html} || $params{headers} || $params{url};
Branch: 1 branch
BranchTrueFalseTotal
unless $params{"html"} or $params{"headers"} or $params{"url"} 0 13 13
Condition83%5/6
$params{"html"} or $params{"headers"} or $params{"url"}
l!l&&r!l&&!r
1210
$params{"html"} or $params{"headers"}
l!l&&r!l&&!r
931
MC/DC0%0/3
$params{"html"} or $params{"headers"} or $params{"url"}
$params{"html"} $params{"headers"} $params{"url"}
Truth table75%3/4
A or B or C
A= $params{"html"}B= $params{"headers"}C= $params{"url"}
ABCresult
1XX1
01X1
0011
0000
99
100 # search will be case insensitive
101 13 ▶ if ( $params{html} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($params{"html"}) 9 4 13
102 9 $params{html} = lc $params{html};
103 }
104  
105 13 ▶ if ( $params{url} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($params{"url"}) 1 12 13
106 1 $params{url} = lc $params{url};
107 }
108  
109 13 my $headers_ref;
110 13 ▶ if ( $params{headers} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($params{"headers"}) 9 4 13
111 9 ▶ die 'Bad headers param' unless ref $params{headers} eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $params{"headers"} eq "HASH" 1 8 9
112  
113 # Make all headers lowercase and array ref valued
114 8 $headers_ref = {};
115 8 ▶ while ( my ( $header, $header_vals_ref ) = each %{ $params{headers} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %{$params{"headers"};}) 9 8 17
116 9 ▶ unless ( ref $header_vals_ref ) {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $header_vals_ref) { } 2 7 9
(do { ref $header_vals_ref ne "ARRAY" }) 1 1 2
117 7 $header_vals_ref = [ $header_vals_ref ];
118 }
119 0 elsif ( ref $header_vals_ref ne 'ARRAY' ) {
120 1 next;
121 }
122  
123 8 $headers_ref->{ lc $header } = [ map { lc } @$header_vals_ref ];
124 }
125 }
126  
127 # Lazy load and process clues from JSON file
128 12 ▶ _load_categories() unless scalar keys %_categories;
Branch: 1 branch
BranchTrueFalseTotal
unless scalar keys %_categories 1 11 12
129  
130 my @cats = $params{cats} && ( ref( $params{cats} ) || '' ) eq 'ARRAY'
131 12 ▶ ? @{ $params{cats} } : get_categories();
Branch: 1 branch
BranchTrueFalseTotal
$params{'cats'} && (ref $params{'cats'} || '') eq 'ARRAY' ? : 2 10 12
Condition60%3/5
$params{"cats"} and (ref $params{"cats"} || "") eq "ARRAY"
!ll&&!rl&&r
1002
ref $params{'cats'} || ''
l!l
20
MC/DC50%1/2
$params{"cats"} and (ref $params{"cats"} || "") eq "ARRAY"
$params{"cats"} ref $params{'cats'}
Truth table66%2/3
A and B
A= $params{"cats"}B= ref $params{'cats'}
ABresult
0X0
100
111
132  
133 12 my %detected;
134 my %tried_multi_cat_apps;
135 12 for my $cat ( @cats ) {
136 519 ▶ my $apps_ref = $_categories{ $cat } or die "Unknown category $cat";
Branch: 1 branch
BranchTrueFalseTotal
my $apps_ref = $_categories{$cat} or die "Unknown category $cat" 0 519 519
137  
138 APP:
139 519 for my $app_ref ( @$apps_ref ) {
140  
141 9103 my $detected;
142  
143 # Some speed optimizations
144 9103 ▶ if ( @cats > 1 && $app_ref->{multi_cat}
Branch: 1 branch
BranchTrueFalseTotal
if (@cats > 1 and $app_ref->{'multi_cat'} and exists $tried_multi_cat_apps{$app_ref->{'name'}}) { } 761 8342 9103
Condition100%6/6
@cats > 1 and $app_ref->{"multi_cat"} and exists $tried_multi_cat_apps{$app_ref->{"name"}}
!ll&&!rl&&r
7692650761
@cats > 1 and $app_ref->{"multi_cat"}
!ll&&!rl&&r
11475781411
MC/DC100%3/3
@cats > 1 and $app_ref->{"multi_cat"} and exists $tried_multi_cat_apps{$app_ref->{"name"}}
@cats > 1 $app_ref->{"multi_cat"} exists $tried_multi_cat_apps{$app_ref->{"name"}}
Truth table100%4/4
A and B and C
A= @cats > 1B= $app_ref->{"multi_cat"}C= exists $tried_multi_cat_apps{$app_ref->{"name"}}
ABCresult
0XX0
10X0
1100
1111
145 && exists $tried_multi_cat_apps{ $app_ref->{name} }
146 ) {
147 761 $detected = $tried_multi_cat_apps{ $app_ref->{name} };
148 }
149 else {
150 # Try regexes...
151 8342 my $confidence = 0;
152  
153 8342 ▶ if ( defined $headers_ref && exists $app_ref->{headers_rules} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $headers_ref and exists $app_ref->{"headers_rules"}) 1947 6395 8342
Condition100%3/3
defined $headers_ref and exists $app_ref->{"headers_rules"}
!ll&&!rl&&r
259538001947
MC/DC100%2/2
defined $headers_ref and exists $app_ref->{"headers_rules"}
defined $headers_ref exists $app_ref->{"headers_rules"}
Truth table100%3/3
A and B
A= defined $headers_refB= exists $app_ref->{"headers_rules"}
ABresult
0X0
100
111
154 1947 my %headers_rules = %{ $app_ref->{headers_rules} };
155  
156 HEADER_RULE:
157 1947 ▶ while ( my ( $header, $rule ) = each %headers_rules ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %headers_rules) 2317 1939 4256
158 2317 ▶ my $header_vals_ref = $headers_ref->{ $header } or next;
Branch: 1 branch
BranchTrueFalseTotal
my $header_vals_ref = $headers_ref->{$header} or next 1696 621 2317
159  
160 621 for my $header_val ( @$header_vals_ref ) {
161 755 ▶ if ( $header_val =~ m/$rule->{re}/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($header_val =~ /$rule->{"re"}/) 8 747 755
162 8 $confidence += $rule->{confidence};
163 8 ▶ if ( $confidence >= 100 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($confidence >= 100) 8 0 8
164 8 $detected = 1;
165 8 last HEADER_RULE;
166 }
167 }
168 }
169 }
170 }
171  
172 8342 ▶ unless ( $detected ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($detected) 8334 8 8342
173 # try from most to least relevant method
174 RULES:
175 8334 for my $rule_type ( qw( html url ) ) {
176 16662 my $rule_name = $rule_type. '_rules';
177 16662 ▶ if ( defined $params{ $rule_type } && exists $app_ref->{ $rule_name } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $params{$rule_type} and exists $app_ref->{$rule_name}) 3960 12702 16662
Condition100%3/3
defined $params{$rule_type} and exists $app_ref->{$rule_name}
!ll&&!rl&&r
1008026223960
MC/DC100%2/2
defined $params{$rule_type} and exists $app_ref->{$rule_name}
defined $params{$rule_type} exists $app_ref->{$rule_name}
Truth table100%3/3
A and B
A= defined $params{$rule_type}B= exists $app_ref->{$rule_name}
ABresult
0X0
100
111
178 3960 for my $rule ( @{ $app_ref->{ $rule_name } } ) {
179 4101 ▶ if ( $params{ $rule_type } =~ m/$rule->{re}/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($params{$rule_type} =~ /$rule->{"re"}/) 9 4092 4101
180 9 $confidence += $rule->{confidence};
181 9 ▶ if ( $confidence >= 100 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($confidence >= 100) 7 2 9
182 7 $detected = 1;
183 7 last RULES;
184 }
185 }
186 }
187 }
188 }
189 }
190  
191 # Some speed optimizations
192 8342 ▶ if ( @cats > 1 && $app_ref->{multi_cat} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@cats > 1 and $app_ref->{"multi_cat"}) 650 7692 8342
Condition100%3/3
@cats > 1 and $app_ref->{"multi_cat"}
!ll&&!rl&&r
1147578650
MC/DC100%2/2
@cats > 1 and $app_ref->{"multi_cat"}
@cats > 1 $app_ref->{"multi_cat"}
Truth table100%3/3
A and B
A= @cats > 1B= $app_ref->{"multi_cat"}
ABresult
0X0
100
111
193 650 $tried_multi_cat_apps{ $app_ref->{name} } = $detected;
194 }
195 }
196  
197 9103 ▶ next unless $detected;
Branch: 1 branch
BranchTrueFalseTotal
unless $detected 9088 15 9103
198  
199 # Detected!
200 15 push @{ $detected{ $cat } }, $app_ref->{name};
201  
202 15 ▶ last APP unless $MULTIPLE_APP_CATS{ $cat };
Branch: 1 branch
BranchTrueFalseTotal
unless $MULTIPLE_APP_CATS{$cat} 14 1 15
203 }
204 }
205  
206 12 return %detected;
207 }
208  
209 =head2 get_categories
210  
211 my @cats = get_categories()
212  
213 Returns the array of all application categories.
214  
215 =cut
216  
217 sub get_categories {
218 # Lazy load and process clues from JSON files
219 11 ▶ _load_categories() unless scalar keys %_categories;
Subroutine get_categories: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
unless scalar keys %_categories 1 10 11
220  
221 11 return keys %_categories;
222 }
223  
224 # Loads and processes clues from JSON files
225 sub _load_categories {
226  
227 2 ▶ for my $clue_file ( @_clues_file_list ) {
Subroutine _load_categories: called CC=12 SCAR=25.5
228 3 ▶ open my $fh, '<', $clue_file
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "<", $clue_file or die "Can not read clues file $clue_file." 0 3 3
229 or die "Can not read clues file $clue_file.";
230  
231 3 local $/ = undef;
232 3 my $json = <$fh>;
233 3 close $fh;
234  
235 # Replace html entities with oridinary symbols
236 3 $json =~ s{&gt;}{>}xig;
237 3 $json =~ s{&lt;}{<}xig;
238  
239 3 my $cfg_ref = eval { JSON::decode_json( $json ) };
240  
241 3 ▶ die "Can't parse clue file $clue_file: $@" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 3 3
242  
243 my $cats_ref = $cfg_ref->{categories}
244 3 ▶ or die "Broken clues file $clue_file. Can not find categories.";
Branch: 1 branch
BranchTrueFalseTotal
my $cats_ref = $cfg_ref->{"categories"} or die "Broken clues file $clue_file. Can not find categories." 0 3 3
245  
246 my $apps_ref = $cfg_ref->{apps}
247 3 ▶ or die "Broken clues file $clue_file. Can not find applications.";
Branch: 1 branch
BranchTrueFalseTotal
my $apps_ref = $cfg_ref->{"apps"} or die "Broken clues file $clue_file. Can not find applications." 0 3 3
248  
249 # Process apps
250 3 ▶ while ( my ( $app, $app_ref ) = each %$apps_ref ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$apps_ref) 1696 3 1699
251  
252 1696 ▶ my $new_app_ref = _process_app_clues( $app, $app_ref ) or next;
Branch: 1 branch
BranchTrueFalseTotal
my $new_app_ref = _process_app_clues($app, $app_ref) or next 0 1696 1696
253  
254 1696 ▶ my @cats = @{ $app_ref->{cats} } or next;
Branch: 1 branch
BranchTrueFalseTotal
my(@cats) = @{$app_ref->{"cats"};} or next 0 1696 1696
255  
256 1696 ▶ $new_app_ref->{multi_cat} = 1 if @cats > 1;
Branch: 1 branch
BranchTrueFalseTotal
if @cats > 1 130 1566 1696
257  
258 1696 for my $cat_id ( @cats ) {
259 1856 ▶ my $cat = $cats_ref->{ $cat_id } or next;
Branch: 1 branch
BranchTrueFalseTotal
my $cat = $cats_ref->{$cat_id} or next 0 1856 1856
260  
261 1856 push @{ $_categories{ $cat } }, $new_app_ref;
262 }
263 }
264 }
265 }
266  
267 # Process clues of given app
268 sub _process_app_clues {
269 1696 ▶ my ( $app, $app_ref ) = @_;
Subroutine _process_app_clues: called CC=12 SCAR=24.8
270  
271 1696 my $new_app_ref = { name => $app };
272  
273 1696 my @fields = grep { exists $app_ref->{$_} } qw( script html meta headers url );
274 1696 my @html_rules;
275 # Precompile regexps
276 1696 for my $field ( @fields ) {
277 2114 my $rule_ref = $app_ref->{ $field };
278 my @rules_list = !ref $rule_ref ? _parse_rule( $rule_ref )
279 2114 ▶ : ref $rule_ref eq 'ARRAY' ? ( map { _parse_rule( $_ ) } @$rule_ref )
Branch: 2 branches
BranchTrueFalseTotal
!ref($rule_ref) ? : 1052 1062 2114
ref $rule_ref eq 'ARRAY' ? : 90 972 1062
280 : () ;
281  
282 2114 ▶ if ( $field eq 'html' ) {
Branch: 5 branches
BranchTrueFalseTotal
if ($field eq 'html') { } 523 1591 2114
elsif ($field eq 'script') { } 547 1044 1591
elsif ($field eq 'url') { } 72 972 1044
elsif ($field eq 'meta') { } 365 607 972
elsif ($field eq 'headers') { } 607 0 607
283 523 push @html_rules, map { $_->{re} = qr/(?-x:$_->{re})/; $_ } @rules_list;
284 }
285 elsif ( $field eq 'script' ) {
286 push @html_rules,
287 map {
288 547 $_->{re} = qr/
289 < \s* script [^>]+ src \s* = \s* ["'] [^"']* (?-x:$_->{re}) [^"']* ["']
290 /x;
291 599 $_
292 } @rules_list;
293 }
294 elsif ( $field eq 'url' ) {
295 72 my @url_rules = map { $_->{re} = qr/(?-x:$_->{re})/; $_ } @rules_list;
296 72 $new_app_ref->{url_rules} = _optimize_rules( \@url_rules );
297 }
298 elsif ( $field eq 'meta' ) {
299 365 for my $key ( keys %$rule_ref ) {
300 397 my $lc_key = lc $key;
301 397 my $name_re = qr/ name \s* = \s* ["']? $lc_key ["']? /x;
302 397 my $rule = _parse_rule( $rule_ref->{$key} );
303 397 $rule->{re} = qr/$rule->{re}/;
304 397 my $content_re = qr/ content \s* = \s* ["'] [^"']* (?-x:$rule->{re}) [^"']* ["'] /x;
305  
306 397 $rule->{re} = qr/
307 < \s* meta \s+
308 (?:
309 (?: $name_re \s+ $content_re )
310 # | (?: $content_re \s+ $name_re ) # hangs sometimes
311 )
312 /x;
313
314 397 push @html_rules, $rule;
315 }
316 }
317 elsif ( $field eq 'headers' ) {
318 607 for my $key ( keys %$rule_ref ) {
319 715 my $rule = _parse_rule( $rule_ref->{$key} );
320 715 $rule->{re} = qr/$rule->{re}/;
321 715 $new_app_ref->{headers_rules}{ lc $key } = $rule;
322 }
323 }
324 }
325  
326 1696 ▶ if ( @html_rules ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@html_rules) 1121 575 1696
327 1121 $new_app_ref->{html_rules} = _optimize_rules( \@html_rules );
328 }
329  
330 1696 return $new_app_ref;
331 }
332  
333 # separate regexp and other optional parameters from the rule
334 sub _parse_rule {
335 2350 ▶ my ( $rule ) = @_;
Subroutine _parse_rule: called CC=5 SCAR=16.1
336
337 2350 my ( $re, @params ) = split /\\;/, $rule;
338
339 2350 my $confidence;
340 2350 for my $param ( @params ) {
341 628 ▶ if ( ( $confidence ) = $param =~ /^\s*confidence\s*:\s*(\d+)\s*$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (($confidence) = $param =~ /^\s*confidence\s*:\s*(\d+)\s*$/) 58 570 628
342 # supports only confidence for now
343 58 last;
344 }
345 }
346
347 return {
348 2350 ▶ re => _escape_re( defined( $re ) ? $re : '' ),
Branch: 1 branch
BranchTrueFalseTotal
defined $re ? : 2274 76 2350
Condition100%2/2
$confidence || 100
l!l
582292
MC/DC100%1/1
$confidence || 100
$confidence
Truth table100%2/2
A
A= $confidence
Aresult
11
00
349 confidence => $confidence || 100,
350 };
351 }
352  
353 # Escape special symbols in regexp string of config file
354 sub _escape_re {
355 2350 ▶ my ( $re ) = @_;
Subroutine _escape_re: called CC=5 SCAR=16.1
356
357 # Escape { } braces
358 #$re =~ s/ ([{}]) /[$1]/xig;
359  
360 # Escape [^]
361 2350 $re =~ s{\Q[^]\E}{[\\^]}ig;
362  
363 # Escape \\1
364 2350 $re =~ s{\Q\1\E}{\\\\1}ig;
365  
366 # Escape (?!
367 2350 $re =~ s{[(][?][!]}{([?]!}ig;
368
369 # turn literals in regexp to lowercase to make case insensitive search
370 # i flag will be slower because we makes many searches in one text
371 3 ▶ no warnings 'redefine';
Subroutine BEGIN: called CC=1 SCAR=0.0
372 2350 ▶ local *Regexp::Parser::warn = sub {}; # it may be too noisy
Subroutine __ANON__: not called CC=1 SCAR=0.0
373
374 2350 my $parser = Regexp::Parser->new();
375 2350 ▶ if ( $parser->regex($re) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parser->regex($re)) 2272 78 2350
376 2272 $re = '';
377
378 2272 ▶ while ( my $node = $parser->next ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $node = $parser->next) 55323 2272 57595
379 55323 my $ref = ref $node;
380 55323 ▶ if ( $ref eq 'Regexp::Parser::exact' || $ref eq 'Regexp::Parser::anyof_char' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ref eq 'Regexp::Parser::exact' or $ref eq 'Regexp::Parser::anyof_char') { } 45215 10108 55323
Condition100%3/3
$ref eq "Regexp::Parser::exact" or $ref eq "Regexp::Parser::anyof_char"
l!l&&r!l&&!r
43873134210108
MC/DC100%2/2
$ref eq "Regexp::Parser::exact" or $ref eq "Regexp::Parser::anyof_char"
$ref eq "Regexp::Parser::exact" $ref eq "Regexp::Parser::anyof_char"
Truth table100%3/3
A or B
A= $ref eq "Regexp::Parser::exact"B= $ref eq "Regexp::Parser::anyof_char"
ABresult
1X1
011
000
381 45215 $re .= lc $node->raw;
382 }
383 else {
384 10108 $re .= $node->raw;
385 }
386 }
387 }
388
389 2350 return $re;
390 }
391  
392 # If possible combine all rules in one regexp
393 sub _optimize_rules {
394 1193 ▶ my ( $rules ) = @_;
Subroutine _optimize_rules: called CC=3 SCAR=11.0
395
396 1193 ▶ if ( @$rules > 1 && @$rules == grep { $_->{confidence} == 100 } @$rules ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@$rules > 1 and @$rules == grep({$_->{"confidence"} == 100;} @$rules)) 317 876 1193
Condition100%3/3
@$rules > 1 and @$rules == grep({$_->{"confidence"} == 100;} @$rules)
!ll&&!rl&&r
85125317
MC/DC100%2/2
@$rules > 1 and @$rules == grep({$_->{"confidence"} == 100;} @$rules)
@$rules > 1 @$rules == grep({$_->{"confidence"} == 100;} @$rules)
Truth table100%3/3
A and B
A= @$rules > 1B= @$rules == grep({$_->{"confidence"} == 100;} @$rules)
ABresult
0X0
100
111
397 # can combine only if confidence for each is 100
398 317 my $re = join '|', map { $_->{re} } @$rules;
399 return [{
400 317 re => qr/$re/,
401 confidence => 100,
402 }];
403 }
404
405 876 return $rules;
406 }
407  
408 =head2 add_clues_file
409  
410 add_clues_file( $filepath )
411  
412 Puts additional clues file to a list of processed clues files.
413 See apps.json as format sample.
414  
415 =cut
416  
417 sub add_clues_file {
418 1 ▶ my ( $filepath ) = @_;
Subroutine add_clues_file: called CC=1 SCAR=0.0
Pod documented
419  
420 1 push @_clues_file_list, $filepath;
421  
422 # just clear out categories to lazy load later
423 1 %_categories = ();
424 }
425  
426 =head1 AUTHOR
427  
428 Alexander Nalobin, C<< <alexander at nalobin.ru> >>
429  
430 =head1 BUGS
431  
432 Please report any bugs or feature requests to C<bug-www-wappalyzer at rt.cpan.org>, or through
433 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Wappalyzer>. I will be notified, and then you'll
434 automatically be notified of progress on your bug as I make changes.
435  
436  
437 =head1 SUPPORT
438  
439 You can find documentation for this module with the perldoc command.
440  
441 perldoc WWW::Wappalyzer
442  
443  
444 You can also look for information at:
445  
446 =over 4
447  
448 =item * GitHub
449  
450 L<https://github.com/nalobin/WWW-Wappalyzer>
451  
452 =item * RT: CPAN's request tracker (report bugs here)
453  
454 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-Wappalyzer>
455  
456 =item * AnnoCPAN: Annotated CPAN documentation
457  
458 L<http://annocpan.org/dist/WWW-Wappalyzer>
459  
460 =item * CPAN Ratings
461  
462 L<http://cpanratings.perl.org/d/WWW-Wappalyzer>
463  
464 =item * Search CPAN
465  
466 L<http://search.cpan.org/dist/WWW-Wappalyzer/>
467  
468 =back
469  
470  
471 =head1 ACKNOWLEDGEMENTS
472  
473  
474 =head1 LICENSE AND COPYRIGHT
475  
476 Copyright 2013-2015 Alexander Nalobin.
477  
478 This program is free software; you can redistribute it and/or modify it
479 under the terms of either: the GNU General Public License as published
480 by the Free Software Foundation; or the Artistic License.
481  
482 See http://dev.perl.org/licenses/ for more information.
483  
484  
485 =cut
486  
487 3 1; # End of WWW::Wappalyzer
↑ Summary