| 1 | package PEF::Front::Config; | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use FindBin; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use File::Basename; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use feature 'state'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | our $project_dir; | |||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | our $app_conf_dir; | |||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | our $app_namespace; | |||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | sub normalize_path { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
normalize_path: called CC=3 SCAR=13.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | my $path = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | if (not $path) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 0 | return '.'; | |||||||||||||||||||||||||||||||||||||||||||||
| 15 | } elsif (substr($path, -1, 1) ne '/') { | ||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | return $path; | |||||||||||||||||||||||||||||||||||||||||||||
| 17 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | return substr($path, 0, -1); | |||||||||||||||||||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 1 | my @std_const_params = qw{ | |||||||||||||||||||||||||||||||||||||||||||||
| 23 | cfg_upload_dir | ||||||||||||||||||||||||||||||||||||||||||||||
| 24 | cfg_captcha_db | ||||||||||||||||||||||||||||||||||||||||||||||
| 25 | cfg_captcha_font | ||||||||||||||||||||||||||||||||||||||||||||||
| 26 | cfg_captcha_image_init | ||||||||||||||||||||||||||||||||||||||||||||||
| 27 | cfg_captcha_image_class | ||||||||||||||||||||||||||||||||||||||||||||||
| 28 | cfg_captcha_secret | ||||||||||||||||||||||||||||||||||||||||||||||
| 29 | cfg_captcha_symbols | ||||||||||||||||||||||||||||||||||||||||||||||
| 30 | cfg_captcha_expire_sec | ||||||||||||||||||||||||||||||||||||||||||||||
| 31 | cfg_model_dir | ||||||||||||||||||||||||||||||||||||||||||||||
| 32 | cfg_cache_file | ||||||||||||||||||||||||||||||||||||||||||||||
| 33 | cfg_cache_size | ||||||||||||||||||||||||||||||||||||||||||||||
| 34 | cfg_cache_method_expire | ||||||||||||||||||||||||||||||||||||||||||||||
| 35 | cfg_cache_module | ||||||||||||||||||||||||||||||||||||||||||||||
| 36 | cfg_cookie_unset_negative_expire | ||||||||||||||||||||||||||||||||||||||||||||||
| 37 | cfg_www_static_dir | ||||||||||||||||||||||||||||||||||||||||||||||
| 38 | cfg_www_static_captchas_dir | ||||||||||||||||||||||||||||||||||||||||||||||
| 39 | cfg_www_static_captchas_path | ||||||||||||||||||||||||||||||||||||||||||||||
| 40 | cfg_in_filter_dir | ||||||||||||||||||||||||||||||||||||||||||||||
| 41 | cfg_out_filter_dir | ||||||||||||||||||||||||||||||||||||||||||||||
| 42 | cfg_db_user | ||||||||||||||||||||||||||||||||||||||||||||||
| 43 | cfg_db_password | ||||||||||||||||||||||||||||||||||||||||||||||
| 44 | cfg_db_name | ||||||||||||||||||||||||||||||||||||||||||||||
| 45 | cfg_db_reconnect_trys | ||||||||||||||||||||||||||||||||||||||||||||||
| 46 | cfg_model_local_dir | ||||||||||||||||||||||||||||||||||||||||||||||
| 47 | cfg_project_dir | ||||||||||||||||||||||||||||||||||||||||||||||
| 48 | cfg_app_namespace | ||||||||||||||||||||||||||||||||||||||||||||||
| 49 | cfg_default_lang | ||||||||||||||||||||||||||||||||||||||||||||||
| 50 | cfg_url_contains_lang | ||||||||||||||||||||||||||||||||||||||||||||||
| 51 | cfg_url_only_camel_case | ||||||||||||||||||||||||||||||||||||||||||||||
| 52 | cfg_template_dir_contains_lang | ||||||||||||||||||||||||||||||||||||||||||||||
| 53 | cfg_no_multilang_support | ||||||||||||||||||||||||||||||||||||||||||||||
| 54 | cfg_location_error | ||||||||||||||||||||||||||||||||||||||||||||||
| 55 | cfg_template_cache | ||||||||||||||||||||||||||||||||||||||||||||||
| 56 | cfg_no_nls | ||||||||||||||||||||||||||||||||||||||||||||||
| 57 | cfg_handle_static | ||||||||||||||||||||||||||||||||||||||||||||||
| 58 | cfg_log_level_info | ||||||||||||||||||||||||||||||||||||||||||||||
| 59 | cfg_log_level_error | ||||||||||||||||||||||||||||||||||||||||||||||
| 60 | cfg_log_level_debug | ||||||||||||||||||||||||||||||||||||||||||||||
| 61 | cfg_session_db_file | ||||||||||||||||||||||||||||||||||||||||||||||
| 62 | cfg_session_ttl | ||||||||||||||||||||||||||||||||||||||||||||||
| 63 | cfg_session_request_field | ||||||||||||||||||||||||||||||||||||||||||||||
| 64 | cfg_session_module | ||||||||||||||||||||||||||||||||||||||||||||||
| 65 | cfg_oauth_connect_timeout | ||||||||||||||||||||||||||||||||||||||||||||||
| 66 | cfg_unknown_msgid_db | ||||||||||||||||||||||||||||||||||||||||||||||
| 67 | cfg_collect_unknown_msgid | ||||||||||||||||||||||||||||||||||||||||||||||
| 68 | cfg_model_rules_reload | ||||||||||||||||||||||||||||||||||||||||||||||
| 69 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 1 | my @std_var_params = qw{ | |||||||||||||||||||||||||||||||||||||||||||||
| 72 | cfg_context_post_hook | ||||||||||||||||||||||||||||||||||||||||||||||
| 73 | cfg_template_dir | ||||||||||||||||||||||||||||||||||||||||||||||
| 74 | cfg_model_rpc | ||||||||||||||||||||||||||||||||||||||||||||||
| 75 | cfg_oauth_client_id | ||||||||||||||||||||||||||||||||||||||||||||||
| 76 | cfg_oauth_client_secret | ||||||||||||||||||||||||||||||||||||||||||||||
| 77 | cfg_oauth_scopes | ||||||||||||||||||||||||||||||||||||||||||||||
| 78 | cfg_logger | ||||||||||||||||||||||||||||||||||||||||||||||
| 79 | cfg_parse_extra_params | ||||||||||||||||||||||||||||||||||||||||||||||
| 80 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 1 | our %config_export; | |||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 1 | ▶ | sub import { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
import: called CC=11 SCAR=25.1
| |||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 1 | my ($modname) = grep {/AppFrontConfig\.pm$/} keys %INC; | |||||||||||||||||||||||||||||||||||||||||||||
| 86 | 1 | die "no config" if 0 && !$modname; | |||||||||||||||||||||||||||||||||||||||||||||
| 87 | 1 | ▶ | $modname = 'fakemodule::' if !$modname; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 1 | ▶ | (undef, $app_conf_dir, undef) = fileparse($INC{$modname} || '', ".pm"); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$INC{$modname} || ''
MC/DC0%0/1
$INC{$modname} || ''
$INC{$modname}
Truth table50%1/2
A
A= $INC{$modname}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 1 | $app_conf_dir = normalize_path($app_conf_dir); | |||||||||||||||||||||||||||||||||||||||||||||
| 90 | 1 | $modname =~ s|\.pm||; | |||||||||||||||||||||||||||||||||||||||||||||
| 91 | 1 | $modname =~ s|/|::|g; | |||||||||||||||||||||||||||||||||||||||||||||
| 92 | 1 | ($app_namespace = $modname) =~ s/::[^:]*$/::/; | |||||||||||||||||||||||||||||||||||||||||||||
| 93 | 1 | my $mp = __PACKAGE__; | |||||||||||||||||||||||||||||||||||||||||||||
| 94 | 1 | my $cp = caller; | |||||||||||||||||||||||||||||||||||||||||||||
| 95 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 1 | my @pa = (\@std_const_params, \@std_var_params); | |||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 1 | ▶ | for (my $i = 0; $i < @pa; ++$i) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 2 | for my $method (@{$pa[$i]}) { | |||||||||||||||||||||||||||||||||||||||||||||
| 100 | 54 | (my $bmn = $method) =~ s/^cfg_//; | |||||||||||||||||||||||||||||||||||||||||||||
| 101 | 54 | ▶ | my $cref = "$modname"->can($method) || *{$mp . "::std_$bmn"}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
"$modname"->can($method) || *{$mp . "::std_$bmn";}
MC/DC0%0/2
"$modname"->can($method) || *{$mp . "::std_$bmn";}
"$modname"->can($method)
*{$mp . "::std_$bmn";}
Truth table33%1/3
A || B
A= "$modname"->can($method)B= *{$mp . "::std_$bmn";}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 54 | *{$mp . "::$method"} = $cref; | |||||||||||||||||||||||||||||||||||||||||||||
| 103 | 54 | *{$cp . "::$method"} = *{$mp . "::$method"}; | |||||||||||||||||||||||||||||||||||||||||||||
| 104 | 54 | ▶ | *{$modname . "::$method"} = $cref if not "$modname"->can($method); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 54 | ▶ | $config_export{$method} = $cref if $i == 0; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 1 | my $exports = \@{$modname . "::EXPORT"}; | |||||||||||||||||||||||||||||||||||||||||||||
| 109 | 1 | for my $e (@$exports) { | |||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | if ((my $cref = "$modname"->can($e))) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | *{$cp . "::$e"} = $cref; | |||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | $config_export{$e} = $cref; | |||||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 1 | ▶ | if ("$modname"->can("project_dir")) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | $project_dir = normalize_path("$modname"->project_dir); | |||||||||||||||||||||||||||||||||||||||||||||
| 117 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 1 | my $lpath = $FindBin::Bin; | |||||||||||||||||||||||||||||||||||||||||||||
| 119 | 1 | $lpath =~ s'(/app$|/conf$|/bin$)''; | |||||||||||||||||||||||||||||||||||||||||||||
| 120 | 1 | $project_dir = $lpath; | |||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | sub std_project_dir {$project_dir} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_project_dir: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | ▶ | sub std_no_nls {0} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_no_nls: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | sub std_unknown_msgid_db {cfg_project_dir() . "/var/cache/unknown-msgid.db"} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_unknown_msgid_db: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | sub std_collect_unknown_msgid {0} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_collect_unknown_msgid: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | ▶ | sub std_template_cache {cfg_project_dir() . "/var/tt_cache"} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_template_cache: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | sub std_location_error {"/appError?msgid=Internal\%20Error"} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_location_error: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | sub std_db_reconnect_trys {30} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_db_reconnect_trys: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | sub std_no_multilang_support {1} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_no_multilang_support: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | sub std_default_lang {'en'} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_default_lang: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | sub std_url_contains_lang {0} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_url_contains_lang: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | sub std_url_only_camel_case {1} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_url_only_camel_case: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | sub std_template_dir_contains_lang {0} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_template_dir_contains_lang: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | ▶ | sub std_handle_static {0} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_handle_static: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 4 | ▶ | sub std_app_namespace {$app_namespace} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_app_namespace: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | sub std_in_filter_dir {"$app_conf_dir/InFilter"} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_in_filter_dir: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | sub std_model_local_dir {"$app_conf_dir/Local"} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_model_local_dir: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | sub std_out_filter_dir {"$app_conf_dir/OutFilter"} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_out_filter_dir: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | sub std_upload_dir {cfg_project_dir() . "/var/upload"} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_upload_dir: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | sub std_captcha_db {cfg_project_dir() . "/var/captcha-db"} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_captcha_db: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | sub std_captcha_font {"giant"} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_captcha_font: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | sub std_captcha_image_init {{}} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_captcha_image_init: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | sub std_captcha_image_class {"PEF::Front::SecureCaptcha"} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_captcha_image_class: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | sub std_captcha_secret {$app_namespace} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_captcha_secret: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | sub std_captcha_expire_sec {300} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_captcha_expire_sec: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | sub std_cache_file {cfg_project_dir() . "/var/cache/shared.cache"} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_cache_file: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | sub std_cache_size {"8m"} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_cache_size: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | sub std_cache_method_expire {60} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_cache_method_expire: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | sub std_cache_module {'Null'} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_cache_module: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | sub std_model_rules_reload {0} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_model_rules_reload: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | sub std_model_dir {cfg_project_dir() . "/model"} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_model_dir: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | ▶ | sub std_www_static_dir {cfg_project_dir() . "/www-static"} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_www_static_dir: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | sub std_www_static_captchas_dir {cfg_project_dir() . "/www-static/captchas"} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_www_static_captchas_dir: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | sub std_db_user {"pef"} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_db_user: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | sub std_db_password {"pef-pass"} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_db_password: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | sub std_db_name {"pef"} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_db_name: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | ▶ | sub std_log_level_info {1} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_log_level_info: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | ▶ | sub std_log_level_error {1} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_log_level_error: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | sub std_log_level_debug {0} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_log_level_debug: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | sub std_session_db_file {cfg_project_dir() . "/var/cache/session.db"} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_session_db_file: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | sub std_session_ttl {86400 * 30} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_session_ttl: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | ▶ | sub std_session_request_field {'auth'} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_session_request_field: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | sub std_session_module {'MLDBM'} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_session_module: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | sub std_cookie_unset_negative_expire {-3600} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_cookie_unset_negative_expire: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | sub std_oauth_connect_timeout {15} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_oauth_connect_timeout: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | sub std_captcha_symbols { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_captcha_symbols: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | state $symbols = ["0" .. "9", split //, "abCdEFgHiJKLMNOPqRSTUVWXyZ"]; | |||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | $symbols; | |||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | sub std_www_static_captchas_path { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_www_static_captchas_path: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | ▶ | if (substr(cfg_www_static_captchas_dir(), 0, length(cfg_www_static_dir())) eq cfg_www_static_dir()) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 176 | # removes cfg_www_static_dir() from cfg_www_static_captchas_dir() and adds '/' | ||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | substr(cfg_www_static_captchas_dir(), length(cfg_www_static_dir())) . '/'; | |||||||||||||||||||||||||||||||||||||||||||||
| 178 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 179 | #must be overriden by user | ||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | '/captchas/'; | |||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | ▶ | sub std_context_post_hook { } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_context_post_hook: not called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | sub std_template_dir { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_template_dir: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | ▶ | cfg_template_dir_contains_lang() | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 188 | ? cfg_project_dir() . "/templates/$_[1]" | ||||||||||||||||||||||||||||||||||||||||||||||
| 189 | : cfg_project_dir() . "/templates"; | ||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | sub std_model_rpc { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_model_rpc: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | PEF::Front::Model::chain_links($_[0]); | |||||||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | sub std_oauth_client_id { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_oauth_client_id: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | state $ids = { | |||||||||||||||||||||||||||||||||||||||||||||
| 198 | yandex => 'anonymous', | ||||||||||||||||||||||||||||||||||||||||||||||
| 199 | google => 'anonymous', | ||||||||||||||||||||||||||||||||||||||||||||||
| 200 | facebook => 'anonymous', | ||||||||||||||||||||||||||||||||||||||||||||||
| 201 | v_kontakte => 'anonymous', | ||||||||||||||||||||||||||||||||||||||||||||||
| 202 | git_hub => 'anonymous', | ||||||||||||||||||||||||||||||||||||||||||||||
| 203 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | $ids->{$_[0]}; | |||||||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | sub std_oauth_client_secret { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_oauth_client_secret: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | state $secrets = { | |||||||||||||||||||||||||||||||||||||||||||||
| 209 | yandex => 'anonymous_secret', | ||||||||||||||||||||||||||||||||||||||||||||||
| 210 | google => 'anonymous_secret', | ||||||||||||||||||||||||||||||||||||||||||||||
| 211 | facebook => 'anonymous_secret', | ||||||||||||||||||||||||||||||||||||||||||||||
| 212 | v_kontakte => 'anonymous_secret', | ||||||||||||||||||||||||||||||||||||||||||||||
| 213 | git_hub => 'anonymous_secret', | ||||||||||||||||||||||||||||||||||||||||||||||
| 214 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | $secrets->{$_[0]}; | |||||||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | ▶ | sub std_oauth_scopes { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_oauth_scopes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | state $scopes = { | |||||||||||||||||||||||||||||||||||||||||||||
| 220 | yandex => {user_info => undef}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 221 | v_kontakte => {user_info => undef}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 222 | git_hub => {user_info => 'user'}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 223 | google => { | ||||||||||||||||||||||||||||||||||||||||||||||
| 224 | email => 'https://www.googleapis.com/auth/userinfo.email', | ||||||||||||||||||||||||||||||||||||||||||||||
| 225 | share => 'https://www.googleapis.com/auth/plus.stream.write', | ||||||||||||||||||||||||||||||||||||||||||||||
| 226 | user_info => 'https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile' | ||||||||||||||||||||||||||||||||||||||||||||||
| 227 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 228 | facebook => { | ||||||||||||||||||||||||||||||||||||||||||||||
| 229 | email => 'email', | ||||||||||||||||||||||||||||||||||||||||||||||
| 230 | share => 'publish_actions', | ||||||||||||||||||||||||||||||||||||||||||||||
| 231 | user_info => 'email', | ||||||||||||||||||||||||||||||||||||||||||||||
| 232 | offline => 'offline_access' | ||||||||||||||||||||||||||||||||||||||||||||||
| 233 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 234 | v_kontakte => {user_info => undef}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 235 | git_hub => {user_info => 'user'}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 236 | msn => { | ||||||||||||||||||||||||||||||||||||||||||||||
| 237 | email => 'wl.emails', | ||||||||||||||||||||||||||||||||||||||||||||||
| 238 | offline => 'wl.offline_access', | ||||||||||||||||||||||||||||||||||||||||||||||
| 239 | share => 'wl.share', | ||||||||||||||||||||||||||||||||||||||||||||||
| 240 | user_info => 'wl.basic wl.emails', | ||||||||||||||||||||||||||||||||||||||||||||||
| 241 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 242 | paypal => { | ||||||||||||||||||||||||||||||||||||||||||||||
| 243 | email => 'email', | ||||||||||||||||||||||||||||||||||||||||||||||
| 244 | user_info => 'email profile phone address', | ||||||||||||||||||||||||||||||||||||||||||||||
| 245 | all => 'email openid profile phone address' | ||||||||||||||||||||||||||||||||||||||||||||||
| 246 | . 'https://uri.paypal.com/services/paypalattributes' | ||||||||||||||||||||||||||||||||||||||||||||||
| 247 | . ' https://uri.paypal.com/services/expresscheckout', | ||||||||||||||||||||||||||||||||||||||||||||||
| 248 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 249 | linked_in => { | ||||||||||||||||||||||||||||||||||||||||||||||
| 250 | email => 'r_emailaddress', | ||||||||||||||||||||||||||||||||||||||||||||||
| 251 | share => 'rw_nus', | ||||||||||||||||||||||||||||||||||||||||||||||
| 252 | user_info => 'r_emailaddress r_fullprofile', | ||||||||||||||||||||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||||||
| 255 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | $scopes->{$_[0]}; | |||||||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | ▶ | sub std_logger { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_logger: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | my $request = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||
| 261 | $request->{env}{'psgix.logger'} | ||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | ▶ | || sub {$request->{env}{'psgi.errors'}->print($_[0]->{message});} | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | sub std_parse_extra_params { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
std_parse_extra_params: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | my ($src, $params, $form) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | ▶ | if (($src eq 'get' || $src eq 'app') && $params ne '') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$src eq "get" || $src eq "app" and $params ne ""
$src eq "get" or $src eq "app"
MC/DC0%0/3
$src eq "get" || $src eq "app" and $params ne ""
$src eq "get"
$src eq "app"
$params ne ""
Truth table0%0/5
A or B and C
A= $src eq "get"B= $src eq "app"C= $params ne ""
| |||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | my @params = split /\//, $params; | |||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | my $i = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | for my $pv (@params) { | |||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | my ($p, $v) = split /-/, $pv, 2; | |||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | if (!defined($v)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | $v = $p; | |||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | $p = 'cookie'; | |||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | ▶ | if (exists $form->{$p}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | $p = "get_param_$i"; | |||||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | ++$i; | |||||||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | $form->{$p} = $v; | |||||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | ▶ | sub cfg { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cfg: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | my $key = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | my $cfg_key = "cfg_" . $key; | |||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | ▶ | if (exists $config_export{$cfg_key}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | $config_export{$cfg_key}->(); | |||||||||||||||||||||||||||||||||||||||||||||
| 291 | } elsif (exists $config_export{$key}) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | $config_export{$key}->(); | |||||||||||||||||||||||||||||||||||||||||||||
| 293 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | warn "Unknown config key: $key"; | |||||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | undef; | |||||||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||||||
| 301 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||