| 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
| |||||||||||
| 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
| |||||||||||
| 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
| |||||||||||
| 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__ | ||||||||||