DDG/Meta/Helper.pm

filter: Statementstmt 94.4% 34 / 36 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 81.8% 9 / 11 Podpod 0.0% 0 / 1 totaltotal 88.8% 48 / 54 CC 4 SCAR 3.7
CC
4
Cov
93%
apply_keywords
2.0
__ANON__
2.0
__ANON__
2.0
CRAP 1.4
« DDG/Meta/Block.pm ↑ Summary DDG/Block/Blockable/Any.pm »
1 package DDG::Meta::Helper;
2 11 our $AUTHORITY = 'cpan:DDG';
3 # ABSTRACT: Helper functions for easy access to important functions
4 11 $DDG::Meta::Helper::VERSION = '1017';
5 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 11 ▶use Carp qw( croak );
Subroutine BEGIN: called CC=1 SCAR=0.0
8 11 ▶use Package::Stash;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 11 ▶use HTML::Entities;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 11 ▶use URI::Escape;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12  
13 11 my %applied;
14  
15 sub apply_keywords {
16 35 ▶ my ( $class, $target ) = @_;
Subroutine apply_keywords: called CC=2 SCAR=7.0
Pod undocumented
17  
18 35 ▶ return if exists $applied{$target};
Branch: 1 branch
BranchTrueFalseTotal
if exists $applied{$target} 0 35 35
19 35 $applied{$target} = undef;
20  
21 35 my $stash = Package::Stash->new($target);
22  
23  
24 35 ▶ $stash->add_symbol('&html_enc', sub { return (wantarray) ? map { encode_entities($_) } @_ : encode_entities(join '', @_) });
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 3 2 5
25  
26  
27 35 ▶ $stash->add_symbol('&uri_esc', sub { return (wantarray) ? map { uri_escape($_) } @_ : uri_escape(join '', @_) });
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 3 2 5
28  
29  
30 35 ▶ $stash->add_symbol('&true', sub { 1 });
Subroutine __ANON__: not called CC=1 SCAR=1.2
31 35 ▶ $stash->add_symbol('&false', sub { 0 });
Subroutine __ANON__: not called CC=1 SCAR=1.2
32 }
33  
34 11 1;
35  
36 __END__
« DDG/Meta/Block.pm ↑ Summary DDG/Block/Blockable/Any.pm »