| 1 | package YATT::Lite::Factory; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 72 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 72 | ▶ | use warnings qw(FATAL all NONFATAL misc); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 72 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 72 | ▶ | use YATT::Lite::Breakpoint; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | sub MY () {__PACKAGE__} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 72 | ▶ | use mro 'c3'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 72 | ▶ | use constant DEBUG_FACTORY => $ENV{DEBUG_YATT_FACTORY}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 72 | ▶ | use constant DEBUG_REFCNT => $ENV{DEBUG_YATT_REFCNT}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 72 | ▶ | use if DEBUG_REFCNT, B => qw/svref_2object/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 72 | ▶ | use 5.010; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 72 | ▶ | use Scalar::Util qw(weaken); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 72 | ▶ | use Encode qw/decode/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 72 | ▶ | use parent qw/File::Spec YATT::Lite::Site YATT::Lite::NSBuilder/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 72 | ▶ | use File::Path (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 72 | ▶ | use File::Basename qw/dirname/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 72 | ▶ | use YATT::Lite::PSGIEnv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | #---------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | # Subclass may override this to 0 to revert old behavior. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 24 | ▶ | sub use_sibling_config_dir { 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
use_sibling_config_dir: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | #---------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | # Note: Definition of default values are not yet gathered here. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | # Some are in YATT::Lite, others are in YATT::Lite::Core, CGen.. and so on. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | use YATT::Lite::MFields | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 72 | ▶ | ([namespace => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | (doc => "namespace prefix for yatt. (default: [yatt, perl])")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | , ["^doc_root" => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | (doc => "Primary template directory")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | # Note: Don't confuse 'app_rootname' below with 'app_root'. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | # 'app_root' is defined in YATT::Lite::Partial::AppPath. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | , [app_rootname => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | (doc => "rootname() of app.psgi. Used to find app.site_config.yml")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | , ["^app_base" => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | (doc => "Base template dir for all DirApps")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | , ["^site_prefix" => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | (doc => "Location prefix for this siteapp")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | , [index_name => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | (doc => "Rootname of index template. (default: index)")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | , [ext_public => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | (doc => "public file extension for yatt. (default: yatt)")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | , [ext_private => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | (doc => "hidden file extension for yatt. (default: ytmpl)")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | , [header_charset => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | (doc => "Charset for outgoing HTTP Content-Type. (default: utf-8)")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | , [tmpl_encoding => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | (doc => "Perl encoding used while reading yatt templates. (default: 'utf-8')")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | , [output_encoding => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | (doc => "Perl encoding used for outgoing response body." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | ." Also this is used to decode incoming request parameters and PATH_INFO." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | ." (default: 'utf-8')")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | , [render_as_bytes => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | (doc => "Force render() to return raw bytes. (default: false)")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | , ["^offline" => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | (doc => "Whether header should be emitted or not.")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | , [binary_config => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | (doc => "(This may be changed in future release) Whether .htyattconfig.* should be read with encoding or not.")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | , [no_unicode => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | (doc => "(Compatibility option) Avoid use of utf8.")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | , [no_unicode_params => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | (doc => "(Compatibility option) Avoid encoding conversion of input params.")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | , [use_subpath => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | (doc => "pass sub-path_info")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | , qw/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | allow_missing_dir | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | no_preload_app_base | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | _tmpldirs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | _loc2yatt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | _path2yatt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | _loc2psgi_re | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | _loc2psgi_dict | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | _tmpl_cache | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | _path2entns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | _entns2vfs_item | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | debug_cgen | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | only_parse | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | config_filetypes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | dont_map_args | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | dont_debug_param | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | always_refresh_deps | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | no_mro_c3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | special_entities | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | default_lang | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | no_lineinfo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | debug_parser | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | check_lineno | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | _outer_psgi_app | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | _my_psgi_app | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | match_argsroute_first | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | allow_bare_entity_in_decl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | no_chdir | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | / | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | , [pagevars => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | (doc => "Package name of per-page compile-time constants (see YATT::Lite::PageConsts)")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | , [argmacro => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | (doc => "Map of argmacro name to Perl module which defines it, or list of such maps optionally paired with namespace like [[ns => {name => Module}], {...}] (see YATT::Lite::ArgMacro)")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | , [stash_unknown_params_to => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | (doc => "Stash unknown foreign parameters into this name. Set to 'yatt.unknown_params' when PLACK_ENV is *not* development.")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | , [body_argument => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | (doc => "Name of 'body' argument. (default: body)")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | , [body_argument_type => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | (doc => "Type of 'body' argument. (default: code)")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | , [prefer_call_for_entity => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | (doc => ":name is interpreted as call if appropriate")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | , [no_conditional_call => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | (doc => "Disable conditional call (if=/unless= in widget call arguments)")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 72 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 72 | ▶ | use YATT::Lite::Util::AsBase qw/-as_base import/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 72 | ▶ | use YATT::Lite::Util qw/lexpand globref untaint_any ckrequire dofile_in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | lookup_dir fields_hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | lookup_path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | trim_ext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | secure_text_plain | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | psgi_error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | psgi_text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | globref_default | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | define_const | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | terse_dump | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | psgi_dump | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | raise_psgi_dump | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | raise_response | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | trimleft_length | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | get_entity_symbol | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 72 | /; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 72 | ▶ | use YATT::Lite::XHF (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 72 | ▶ | use YATT::Lite::Partial::ErrorReporter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 72 | ▶ | use YATT::Lite::Partial::AppPath; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 72 | ▶ | use YATT::Lite qw/Entity *SYS *YATT *CON/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 72 | our @EXPORT_OK = qw/*CON/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 72 | ▶ | use YATT::Lite::Util::CycleDetector qw/Visits/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 72 | our $want_object; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 20 | ▶ | sub want_object { $want_object } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
want_object: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 4 | ▶ | sub find_load_factory_script { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_load_factory_script: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 4 | my ($pack, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 4 | my $stop_at = delete $opts{stop_at}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | my ($found) = $pack->find_factory_script(delete $opts{dir} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 4 | ▶ | , stop_at => $stop_at) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 4 | ▶ | my $self = $pack->load_factory_script($found) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | or croak "Can't load YATT::Lite::Factory instance from $found"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 4 | $self->configure(%opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 4 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 2 | ▶ | sub load_factory_offline { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_factory_offline: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 2 | shift->find_load_factory_script(offline => 1, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 36 | ▶ | sub configure_offline { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
configure_offline: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 36 | (my MY $self, my $value) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 36 | $self->{offline} = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 36 | ▶ | if ($self->{offline}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 9 | ▶ | $self->configure(error_handler => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 9 | my ($type, $err) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 9 | die $err; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 36 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | # $class->create_factory_class($fresh_classname) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | # Make $fresh_classname inherit Factory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | # Mainly for tests which create many factory classes in single run. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 8 | ▶ | sub create_factory_class { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_factory_class: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 8 | my ($pack, $factory_class) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 8 | define_const(globref($factory_class, 'default_app_ns') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | , $factory_class."::YATT"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 8 | $pack->_import_as_base($factory_class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 8 | $factory_class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 24 | ▶ | sub load_factory_for_psgi { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_factory_for_psgi: called CC=14 SCAR=28.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 24 | my ($pack, $psgi, %default) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 24 | ▶ | unless (defined $psgi) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | croak "Usage: Factory->load_factory_for_psgi(psgi_filename, \%opts)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 24 | ▶ | unless (-r $psgi) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | croak "psgi is not readable: $psgi"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | # GH-260: rel2abs does not collapse "..". Without normalization, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | # "$app_root.config.d" built from ".../t/.." can never exist. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 24 | (my $app_rootname = YATT::Lite::Util::normalize_fs_path($pack->rel2abs($psgi))) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | =~ s/\.psgi$//; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 24 | ▶ | $default{app_rootname} //= $app_rootname; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$default{"app_rootname"} //= $app_rootname
MC/DC0%0/2
$default{"app_rootname"} //= $app_rootname
$default{"app_rootname"}
$app_rootname
Truth table33%1/3
A //= B
A= $default{"app_rootname"}B= $app_rootname
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | # Assume app_root is safe. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 24 | my $app_root = untaint_any(dirname($app_rootname)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 24 | ▶ | unless (-d $app_root) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | croak "Can't find app_root for $psgi"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 24 | ▶ | $default{doc_root} ||= "$app_root/html"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$default{"doc_root"} ||= "$app_root/html"
MC/DC100%1/1
$default{"doc_root"} ||= "$app_root/html"
$default{"doc_root"}
Truth table100%2/2
A
A= $default{"doc_root"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 24 | ▶ | if (-d "$app_root/ytmpl") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 3 | ▶ | $default{app_base} ||= '@ytmpl'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$default{"app_base"} ||= "\@ytmpl"
MC/DC100%1/1
$default{"app_base"} ||= "\@ytmpl"
$default{"app_base"}
Truth table100%2/2
A
A= $default{"app_base"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 24 | my $env = delete $default{environment}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 24 | my (@cf) = $pack->list_app_config_files($app_root, File::Basename::basename($app_rootname)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 24 | ▶ | if (@cf and $env) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
@cf and $env
MC/DC0%0/2
@cf and $env
@cf
$env
Truth table66%2/3
A and B
A= @cfB= $env
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | croak "Can't use environment and @cf at once!"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | } elsif (@cf > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | croak "Multiple configuration files!: @cf"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 24 | ▶ | if ($env) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 1 | my $config = $pack->config_for_env($app_root, $env); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 1 | ▶ | return $pack->_with_loading_file($config, sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 1 | $pack->new(app_root => $app_root, %default | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | , $pack->load_config($config)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 1 | }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 23 | my MY $self = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 23 | ▶ | if (@cf) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 3 | ▶ | $pack->_with_loading_file($cf[0], sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 3 | $pack->new(app_root => $app_root, %default | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | , $pack->read_file($cf[0])); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 3 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 20 | $pack->new(app_root => $app_root, %default); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 23 | ▶ | unless ($self->{__after_new_is_called__}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | Carp::croak("after_new is not called correctly!"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 23 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 24 | ▶ | sub list_app_config_files { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list_app_config_files: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 24 | my ($pack, $app_root, $app_base) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | # When psgi is at $app_root/app.psgi, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | # test $app_root.config.d/app.{xhf,yml} and return them if exists. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | # Otherwise list $app_root/app.{xhf,yml}. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 24 | ▶ | if ($pack->use_sibling_config_dir) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 24 | my $sibling_config_dir = "$app_root.config.d"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 24 | ▶ | if (-d $sibling_config_dir) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 2 | my @cf = $pack->list_config_files("$sibling_config_dir/$app_base"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 2 | ▶ | return @cf if @cf; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 22 | $pack->list_config_files("$app_root/$app_base"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | # Load Amon2 style config.pl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 1 | ▶ | sub config_for_env { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
config_for_env: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 1 | my ($pack, $app_root, $environment) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 1 | "$app_root/config/$environment.pl"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 1 | ▶ | sub load_config { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_config: called CC=4 SCAR=15.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 1 | my ($pack, $cf) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 1 | my $config = dofile_in($pack, $cf); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 1 | ▶ | unless (defined $config) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | croak "config script '$cf' returned undef!"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 1 | ▶ | unless (ref $config eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | croak "config script '$cf' doesn't return HASH! $config"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 1 | ▶ | wantarray ? %$config : $config; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 72 | my ($_n_created, $_n_destroyed); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 1 | ▶ | sub n_created {$_n_created} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
n_created: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 1 | ▶ | sub n_destroyed {$_n_destroyed} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
n_destroyed: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 72 | our %sub2self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 176 | ▶ | DESTROY { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 176 | (my MY $self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 176 | if (DEBUG_FACTORY) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | if (DEBUG_REFCNT) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | printf STDERR "# DESTROY %s refcnt=%d\n", $self, svref_2object($self)->REFCNT; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | print STDERR "# DESTROY $self\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 176 | delete $self->{_my_psgi_app}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 176 | ▶ | if (my $outer = delete $self->{_outer_psgi_app}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | delete $sub2self{$outer}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 176 | ++$_n_destroyed; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | ▶ | sub to_app_and_forget { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to_app_and_forget: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | (my MY $self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | my $sub = $self->to_app; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | delete $self->{_my_psgi_app}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | delete $self->{_outer_psgi_app}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | delete $sub2self{$sub}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | $sub; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 86 | ▶ | sub to_app { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to_app: called CC=5 SCAR=16.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 86 | (my MY $self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 86 | ▶ | if (@_ >= 2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | croak "cascade support is dropped.Use wrapped_by(builder {}) instead."; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 86 | ▶ | $self->{_outer_psgi_app} // do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"_outer_psgi_app"} // do {
if (my $old = delete $self->{"_my_psgi_app"}) {
delete $YATT::Lite::Factory::sub2self{$old};
};
$self->prepare_app;
my $sub = sub {
$self->call(@_);
}
;
$self->{"_my_psgi_app"} = $sub;
builtin::weaken($self->{"_my_psgi_app"}) unless $YATT::Lite::Factory::want_object;
builtin::weaken($YATT::Lite::Factory::sub2self{$sub} = $self);
'???';
$sub
}
MC/DC0%0/2
$self->{"_outer_psgi_app"} // do {
if (my $old = delete $self->{"_my_psgi_app"}) {
delete $YATT::Lite::Factory::sub2self{$old};
};
$self->prepare_app;
my $sub = sub {
$self->call(@_);
}
;
$self->{"_my_psgi_app"} = $sub;
builtin::weaken($self->{"_my_psgi_app"}) unless $YATT::Lite::Factory::want_object;
builtin::weaken($YATT::Lite::Factory::sub2self{$sub} = $self);
'???';
$sub
}
$self->{"_outer_psgi_app"}
do {
if (my $old = delete $self->{"_my_psgi_app"}) {
delete $YATT::Lite::Factory::sub2self{$old};
};
$self->prepare_app;
my $sub = sub {
$self->call(@_);
}
;
$self->{"_my_psgi_app"} = $sub;
builtin::weaken($self->{"_my_psgi_app"}) unless $YATT::Lite::Factory::want_object;
builtin::weaken($YATT::Lite::Factory::sub2self{$sub} = $self);
'???';
$sub
}
Truth table33%1/3
A // B
A= $self->{"_outer_psgi_app"}B= do {
if (my $old = delete $self->{"_my_psgi_app"}) {
delete $YATT::Lite::Factory::sub2self{$old};
};
$self->prepare_app;
my $sub = sub {
$self->call(@_);
}
;
$self->{"_my_psgi_app"} = $sub;
builtin::weaken($self->{"_my_psgi_app"}) unless $YATT::Lite::Factory::want_object;
builtin::weaken($YATT::Lite::Factory::sub2self{$sub} = $self);
'???';
$sub
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 86 | ▶ | if (my $old = delete $self->{_my_psgi_app}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 3 | delete $sub2self{$old}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 86 | $self->prepare_app; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 86 | ▶ | my $sub = sub { $self->call(@_) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 86 | $self->{_my_psgi_app} = $sub; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 86 | ▶ | weaken($self->{_my_psgi_app}) if not $want_object; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 86 | weaken($sub2self{$sub} = $self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 86 | print STDERR "to_app($self) returned $sub\n" if DEBUG_FACTORY; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 86 | $sub; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 6 | ▶ | sub wrapped_by { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
wrapped_by: called CC=3 SCAR=11.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 6 | my ($self, $outer_app) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 6 | ▶ | unless ($self->{_my_psgi_app}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | croak "wrapped_by is called without calling Site->to_app"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 6 | delete $sub2self{$self->{_my_psgi_app}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 6 | $self->{_outer_psgi_app} = $outer_app; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 6 | $sub2self{$outer_app} = $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 6 | ▶ | weaken($self->{_outer_psgi_app}) if not $want_object; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 6 | weaken($sub2self{$outer_app}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 6 | $outer_app; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 28 | ▶ | sub load_psgi_script { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_psgi_script: called CC=4 SCAR=14.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 28 | my ($pack, $fn) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 28 | local $want_object = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 28 | local $0 = $fn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 28 | my $sub = $pack->sandbox_dofile($fn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 27 | ▶ | if (ref $sub eq 'CODE') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 8 | $sub2self{$sub}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | ▶ | } elsif ($sub->isa($pack) or $sub->isa(MY)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$sub->isa($pack) or $sub->isa("YATT::Lite::Factory")
MC/DC0%0/2
$sub->isa($pack) or $sub->isa("YATT::Lite::Factory")
$sub->isa($pack)
$sub->isa("YATT::Lite::Factory")
Truth table33%1/3
A or B
A= $sub->isa($pack)B= $sub->isa("YATT::Lite::Factory")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 19 | $sub; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | die "Unknown load result from: $fn"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 88 | ▶ | sub prepare_app { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare_app: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 88 | (my MY $self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 88 | $self->maybe::next::method(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 204 | ▶ | sub prepare_deployment { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare_deployment: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 204 | (my MY $self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 204 | $self->maybe::next::method(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | $self->{stash_unknown_params_to} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 204 | ▶ | //= $self->default_stash_unknown_params_to; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"stash_unknown_params_to"} //= $self->default_stash_unknown_params_to
MC/DC0%0/2
$self->{"stash_unknown_params_to"} //= $self->default_stash_unknown_params_to
$self->{"stash_unknown_params_to"}
$self->default_stash_unknown_params_to
Truth table33%1/3
A //= B
A= $self->{"stash_unknown_params_to"}B= $self->default_stash_unknown_params_to
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 386 | ▶ | sub finalize_response { shift->maybe::next::method(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
finalize_response: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 72 | our $load_count; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 28 | ▶ | sub sandbox_dofile { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sandbox_dofile: called CC=4 SCAR=14.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 28 | my ($pack, $file) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 28 | my $sandbox = sprintf "%s::Sandbox::S%d", __PACKAGE__, ++$load_count; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 28 | my @__result__; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 28 | ▶ | if (wantarray) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | @__result__ = dofile_in($sandbox, $file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 28 | $__result__[0] = dofile_in($sandbox, $file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 27 | my $sym = globref($sandbox, 'filename'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 27 | ▶ | unless (*{$sym}{CODE}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 27 | ▶ | *$sym = sub {$file}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 27 | ▶ | wantarray ? @__result__ : $__result__[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 72 | ▶ | sub load_factory_script { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_factory_script: called CC=6 SCAR=18.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 28 | my ($pack, $fn) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 28 | my %was_loaded = map {$_ => 1} keys %INC; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 28 | my $result = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 28 | local $want_object = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 28 | local $0 = $fn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 28 | local ($FindBin::Bin, $FindBin::Script | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | , $FindBin::RealBin, $FindBin::RealScript); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 28 | ▶ | FindBin->again if FindBin->can("again"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 28 | ▶ | if ($fn =~ /\.psgi$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 28 | $pack->load_psgi_script($fn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | $pack->sandbox_dofile($fn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 28 | my $err = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | # アプリが lib/ に同梱した YATT::Lite が、読み込み中の YATT::Lite と | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | # 混ざると、原因の分からないエラーになるので、先に報告する (GH-301) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 28 | ▶ | if (my @mixed = $pack->list_mixed_yatt_lib(\%was_loaded)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | die join("", "Mixed YATT::Lite library roots while loading $fn.\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | , "Running YATT::Lite is from ", $pack->yatt_lib_root, ", but:\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 2 | ▶ | , map({" $_->[0] from $_->[1]\n"} @mixed) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | , "The app may bundle another YATT::Lite in its library path.\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | , $err ? "Original error: $err" : ()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 26 | ▶ | die $err if $err; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 26 | $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | # YATT/Lite/Factory.pm (この file) を読み込んだ library root | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 30 | ▶ | sub yatt_lib_root { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
yatt_lib_root: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 30 | _inc_root('YATT/Lite/Factory.pm'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | # $was_loaded に無い (=新たに読み込まれた) YATT::Lite の module のうち、 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | # yatt_lib_root と違う root から読まれ、しかも yatt_lib_root にも同じ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | # module が有るもの (=別版で上書きされたもの) を [$key, $root] で返す。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | # アプリ独自の YATT::Lite::* module は対象外。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 28 | ▶ | sub list_mixed_yatt_lib { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list_mixed_yatt_lib: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 28 | my ($pack, $was_loaded) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 28 | ▶ | my $root = $pack->yatt_lib_root // return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$pack->yatt_lib_root // (return)
MC/DC0%0/1
$pack->yatt_lib_root // (return)
$pack->yatt_lib_root
Truth table50%1/2
A
A= $pack->yatt_lib_root
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 124 | my $r = _inc_root($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 124 | ▶ | (defined $r and $r ne $root and -e "$root/$_") ? [$_, $r] : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
defined $r and $r ne $root and -e "$root/$_"
defined $r and $r ne $root
MC/DC100%3/3
defined $r and $r ne $root and -e "$root/$_"
defined $r
$r ne $root
-e "$root/$_"
Truth table100%4/4
A and B and C
A= defined $rB= $r ne $rootC= -e "$root/$_"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | } grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 28 | ▶ | m{^YATT/Lite[/.]} and not ($was_loaded and $was_loaded->{$_}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition83%5/6
m[^YATT/Lite[/.]] && !($was_loaded && $was_loaded->{$_})
$was_loaded && $was_loaded->{$_}
MC/DC66%2/3
m[^YATT/Lite[/.]] && !($was_loaded && $was_loaded->{$_})
m[^YATT/Lite[/.]]
$was_loaded
$was_loaded->{$_}
Truth table75%3/4
A && not(B && C)
A= m[^YATT/Lite[/.]]B= $was_loadedC= $was_loaded->{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | } sort keys %INC; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | # %INC の値から $key を取り除いた root。$INC{$key} = 1 のような | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | # 手で登録されたものは undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 154 | ▶ | sub _inc_root { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_inc_root: called CC=5 SCAR=17.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 154 | my ($key) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 154 | my $path = $INC{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 154 | ▶ | return undef unless defined $path and not ref $path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
defined $path and not ref $path and $path =~ s[/\Q$key\E\z][]
defined $path and not ref $path
MC/DC33%1/3
defined $path and not ref $path and $path =~ s[/\Q$key\E\z][]
defined $path
not ref $path
$path =~ s[/\Q$key\E\z][]
Truth table50%2/4
A and not(B) and C
A= defined $pathB= not ref $pathC= $path =~ s[/\Q$key\E\z][]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | and $path =~ s{/\Q$key\E\z}{}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 102 | require Cwd; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 102 | ▶ | Cwd::realpath($path) // $path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
Cwd::realpath($path) // $path
MC/DC0%0/2
Cwd::realpath($path) // $path
Cwd::realpath($path)
$path
Truth table33%1/3
A // B
A= Cwd::realpath($path)B= $path
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | # find_factory_script($dir, %opts): search runyatt.psgi / app.psgi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | # upward from $dir. With stop_at => $boundary the search never leaves | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | # $boundary (compared by realpath, so symlinked workspaces behave), and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | # returns nothing instead. Tools working from their own cwd leave it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | # unset; the language server sets it to the workspace root the client | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | # named, so a script planted above the workspace is never executed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 112 | ▶ | sub find_factory_script { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_factory_script: called CC=8 SCAR=20.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 112 | my $pack = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 112 | my ($start, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 112 | ▶ | my $dir = $pack->rel2abs($start // $pack->curdir); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$start // $pack->curdir
MC/DC0%0/2
$start // $pack->curdir
$start
$pack->curdir
Truth table66%2/3
A // B
A= $startB= $pack->curdir
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | my $boundary = defined $opts{stop_at} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 112 | ▶ | ? $pack->_canonical_dir($opts{stop_at}) : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 112 | my @path = $pack->no_upwards($pack->splitdir($dir)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 112 | my $rootdir = $pack->rootdir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 112 | ▶ | while (@path and length($dir = $pack->catdir(@path)) > length($rootdir)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@path and length($dir = $pack->catdir(@path)) > length $rootdir
MC/DC50%1/2
@path and length($dir = $pack->catdir(@path)) > length $rootdir
@path
length($dir = $pack->catdir(@path)) > length $rootdir
Truth table66%2/3
A and B
A= @pathB= length($dir = $pack->catdir(@path)) > length $rootdir
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 279 | ▶ | if (defined $boundary and not $pack->_dir_is_within($dir, $boundary)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $boundary and not $pack->_dir_is_within($dir, $boundary)
MC/DC100%2/2
defined $boundary and not $pack->_dir_is_within($dir, $boundary)
defined $boundary
not $pack->_dir_is_within($dir, $boundary)
Truth table100%3/3
A and not(B)
A= defined $boundaryB= not $pack->_dir_is_within($dir, $boundary)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 9 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 270 | ▶ | if (my ($found) = grep {-r} map {"$dir/$_.psgi"} qw(runyatt app)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 70 | return $found; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 200 | } continue { pop @path } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 33 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 52 | ▶ | sub _canonical_dir { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_canonical_dir: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 52 | my ($pack, $dir) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 52 | require Cwd; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 52 | my $abs = $pack->rel2abs($dir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 52 | ▶ | Cwd::realpath($abs) // $abs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
Cwd::realpath($abs) // $abs
MC/DC0%0/2
Cwd::realpath($abs) // $abs
Cwd::realpath($abs)
$abs
Truth table66%2/3
A // B
A= Cwd::realpath($abs)B= $abs
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 37 | ▶ | sub _dir_is_within { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dir_is_within: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 37 | my ($pack, $dir, $boundary) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 37 | my $real = $pack->_canonical_dir($dir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 37 | ▶ | return 1 if $boundary eq $pack->rootdir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 37 | ▶ | $real eq $boundary or index($real, "$boundary/") == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | # `use Factory -as_base` in app.psgi will come here. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 44 | ▶ | sub _import_as_base { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_import_as_base: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 44 | my ($myPack, $callpack) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 44 | $myPack->SUPER::_import_as_base($callpack); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | # To define EntNS in $callpack and set $myPack to @{$callpack::ISA}. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 44 | $myPack->default_default_app->define_Entity(undef, $callpack); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | # Just to allow writing `use Factory -Entity;` in your app.psgi. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | # Not actually required. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | ▶ | sub _import_Entity { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_import_Entity: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | my ($myPack, $callpack) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | $myPack->default_default_app->define_Entity(undef, $callpack); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 208 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 208 | my ($class) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 208 | my MY $self = $class->SUPER::new(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 200 | ▶ | $self->preload_app_base unless $self->{no_preload_app_base}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 200 | ++$_n_created; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 200 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | # preload app_base (to avoid potential double-loading bug for base loading) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 200 | ▶ | sub preload_app_base { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
preload_app_base: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 200 | (my MY $self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 200 | foreach my $dir (lexpand($self->{app_base})) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 31 | ▶ | next if $dir =~ m{^::}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 29 | $self->load_yatt($self->app_path_expand($dir)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 208 | ▶ | sub init_app_ns { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_app_ns: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 208 | (my MY $self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 208 | $self->SUPER::init_app_ns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | # EntNS is initialized here. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | # Note: CGEN_perl is not initialized here and delayed until it is required. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | # This helps to avoid loading CGen::Perl for *.ydo in CGI. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 208 | $self->{_default_app}->ensure_entns($self->{_app_ns}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 208 | ▶ | sub after_new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
after_new: called CC=21 SCAR=38.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 208 | (my MY $self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 208 | $self->SUPER::after_new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 208 | ▶ | $self->{app_root} //= YATT::Lite::Util::maybe_findbin_bin(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->{"app_root"} //= YATT::Lite::Util::maybe_findbin_bin()
MC/DC0%0/2
$self->{"app_root"} //= YATT::Lite::Util::maybe_findbin_bin()
$self->{"app_root"}
YATT::Lite::Util::maybe_findbin_bin()
Truth table66%2/3
A //= B
A= $self->{"app_root"}B= YATT::Lite::Util::maybe_findbin_bin()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 208 | ▶ | if (defined $self->{app_root}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 208 | $self->{app_root} = YATT::Lite::Util::normalize_fs_path($self->{app_root}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 208 | ▶ | $self->{index_name} //= $self->default_index_name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"index_name"} //= $self->default_index_name
MC/DC0%0/2
$self->{"index_name"} //= $self->default_index_name
$self->{"index_name"}
$self->default_index_name
Truth table33%1/3
A //= B
A= $self->{"index_name"}B= $self->default_index_name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 208 | ▶ | $self->{ext_public} //= $self->default_ext_public; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->{"ext_public"} //= $self->default_ext_public
MC/DC0%0/2
$self->{"ext_public"} //= $self->default_ext_public
$self->{"ext_public"}
$self->default_ext_public
Truth table66%2/3
A //= B
A= $self->{"ext_public"}B= $self->default_ext_public
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 208 | ▶ | $self->{ext_private} //= $self->default_ext_private; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"ext_private"} //= $self->default_ext_private
MC/DC0%0/2
$self->{"ext_private"} //= $self->default_ext_private
$self->{"ext_private"}
$self->default_ext_private
Truth table33%1/3
A //= B
A= $self->{"ext_private"}B= $self->default_ext_private
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 208 | ▶ | if ($self->{no_unicode}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 0 | $self->{no_unicode_params} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | $self->{binary_config} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | $self->{header_charset} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | ▶ | //= ($self->{output_encoding} || $self->default_header_charset); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$self->{"header_charset"} //= $self->{"output_encoding"} || $self->default_header_charset
$self->{'output_encoding'} || $self->default_header_charset
MC/DC0%0/3
$self->{"header_charset"} //= $self->{"output_encoding"} || $self->default_header_charset
$self->{"header_charset"}
$self->{'output_encoding'}
$self->default_header_charset
Truth table0%0/4
A //= B || C
A= $self->{"header_charset"}B= $self->{'output_encoding'}C= $self->default_header_charset
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | $self->{output_encoding} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 0 | ▶ | //= $self->compat_default_output_encoding; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"output_encoding"} //= $self->compat_default_output_encoding
MC/DC0%0/2
$self->{"output_encoding"} //= $self->compat_default_output_encoding
$self->{"output_encoding"}
$self->compat_default_output_encoding
Truth table0%0/3
A //= B
A= $self->{"output_encoding"}B= $self->compat_default_output_encoding
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 0 | $self->{render_as_bytes} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | $self->{header_charset} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 208 | ▶ | //= ($self->{output_encoding} // $self->default_header_charset); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%4/6
$self->{"header_charset"} //= $self->{"output_encoding"} // $self->default_header_charset
$self->{"output_encoding"} // $self->default_header_charset
MC/DC0%0/3
$self->{"header_charset"} //= $self->{"output_encoding"} // $self->default_header_charset
$self->{"header_charset"}
$self->{"output_encoding"}
$self->default_header_charset
Truth table0%0/4
A //= B // C
A= $self->{"header_charset"}B= $self->{"output_encoding"}C= $self->default_header_charset
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | $self->{tmpl_encoding} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 208 | ▶ | //= ($self->{output_encoding} // $self->default_tmpl_encoding); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%4/6
$self->{"tmpl_encoding"} //= $self->{"output_encoding"} // $self->default_tmpl_encoding
$self->{"output_encoding"} // $self->default_tmpl_encoding
MC/DC0%0/3
$self->{"tmpl_encoding"} //= $self->{"output_encoding"} // $self->default_tmpl_encoding
$self->{"tmpl_encoding"}
$self->{"output_encoding"}
$self->default_tmpl_encoding
Truth table0%0/4
A //= B // C
A= $self->{"tmpl_encoding"}B= $self->{"output_encoding"}C= $self->default_tmpl_encoding
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 208 | ▶ | $self->{output_encoding} //= $self->default_output_encoding; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->{"output_encoding"} //= $self->default_output_encoding
MC/DC0%0/2
$self->{"output_encoding"} //= $self->default_output_encoding
$self->{"output_encoding"}
$self->default_output_encoding
Truth table66%2/3
A //= B
A= $self->{"output_encoding"}B= $self->default_output_encoding
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 208 | ▶ | $self->{use_subpath} //= 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"use_subpath"} //= 1
MC/DC100%1/1
$self->{"use_subpath"} //= 1
$self->{"use_subpath"}
Truth table100%2/2
A
A= $self->{"use_subpath"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 208 | ▶ | $self->{always_refresh_deps} //= $self->default_always_refresh_deps; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->{"always_refresh_deps"} //= $self->default_always_refresh_deps
MC/DC0%0/2
$self->{"always_refresh_deps"} //= $self->default_always_refresh_deps
$self->{"always_refresh_deps"}
$self->default_always_refresh_deps
Truth table66%2/3
A //= B
A= $self->{"always_refresh_deps"}B= $self->default_always_refresh_deps
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 208 | ▶ | $self->{body_argument} //= $self->default_body_argument; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"body_argument"} //= $self->default_body_argument
MC/DC0%0/2
$self->{"body_argument"} //= $self->default_body_argument
$self->{"body_argument"}
$self->default_body_argument
Truth table33%1/3
A //= B
A= $self->{"body_argument"}B= $self->default_body_argument
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 208 | ▶ | $self->{body_argument_type} //= $self->default_body_argument_type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->{"body_argument_type"} //= $self->default_body_argument_type
MC/DC0%0/2
$self->{"body_argument_type"} //= $self->default_body_argument_type
$self->{"body_argument_type"}
$self->default_body_argument_type
Truth table66%2/3
A //= B
A= $self->{"body_argument_type"}B= $self->default_body_argument_type
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | # prepare_app is too late to set delegated params | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 208 | ▶ | if (($ENV{PLACK_ENV} // '') ne 'development') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$ENV{"PLACK_ENV"} // ""
MC/DC100%1/1
$ENV{"PLACK_ENV"} // ""
$ENV{"PLACK_ENV"}
Truth table100%2/2
A
A= $ENV{"PLACK_ENV"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 204 | $self->prepare_deployment; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | ▶ | sub compat_default_output_encoding { '' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
compat_default_output_encoding: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 180 | ▶ | sub default_output_encoding { 'utf-8' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_output_encoding: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 178 | ▶ | sub default_header_charset { 'utf-8' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_header_charset: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 180 | ▶ | sub default_tmpl_encoding { 'utf-8' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_tmpl_encoding: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 208 | ▶ | sub default_index_name { 'index' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_index_name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 206 | ▶ | sub default_ext_public {'yatt'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_ext_public: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 208 | ▶ | sub default_ext_private {'ytmpl'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_ext_private: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 204 | ▶ | sub default_stash_unknown_params_to {'yatt.unknown_params'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_stash_unknown_params_to: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 205 | ▶ | sub default_always_refresh_deps { 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_always_refresh_deps: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 208 | ▶ | sub default_body_argument { 'body' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_body_argument: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 207 | ▶ | sub default_body_argument_type { 'code' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_body_argument_type: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 201 | ▶ | sub _after_after_new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_after_after_new: called CC=8 SCAR=20.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 201 | (my MY $self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 201 | $self->SUPER::_after_after_new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 201 | ▶ | if ($self->{doc_root}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | # GH-260: keep doc_root textually consistent with the normalized | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | # app_root; rel_app_name relies on prefix-length arithmetic. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 200 | $self->{doc_root} = YATT::Lite::Util::normalize_fs_path($self->{doc_root}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 201 | ▶ | if (not $self->{allow_missing_dir} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
not $self->{"allow_missing_dir"} and $self->{"doc_root"} and not -d $self->{"doc_root"}
not $self->{"allow_missing_dir"} and $self->{"doc_root"}
MC/DC0%0/3
not $self->{"allow_missing_dir"} and $self->{"doc_root"} and not -d $self->{"doc_root"}
not $self->{"allow_missing_dir"}
$self->{"doc_root"}
not -d $self->{"doc_root"}
Truth table50%2/4
not(A) and B and not(C)
A= not $self->{"allow_missing_dir"}B= $self->{"doc_root"}C= not -d $self->{"doc_root"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | and $self->{doc_root} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | and not -d $self->{doc_root}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 0 | croak "document_root '$self->{doc_root}' is missing!"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 201 | ▶ | if ($self->{doc_root}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 200 | trim_slash($self->{doc_root}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | # XXX: $self->{tmpldirs} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 201 | ▶ | $self->{site_prefix} //= ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"site_prefix"} //= ""
MC/DC100%1/1
$self->{"site_prefix"} //= ""
$self->{"site_prefix"}
Truth table100%2/2
A
A= $self->{"site_prefix"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 201 | $self->{_tmpldirs} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 201 | ▶ | if (my $dir = $self->{doc_root}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 200 | push @{$self->{_tmpldirs}}, $dir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 200 | my $refcnt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 200 | if (DEBUG_REFCNT) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | $refcnt = svref_2object($self)->REFCNT; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 200 | $self->get_yatt('/'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 199 | if (DEBUG_REFCNT) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | if (svref_2object($self)->REFCNT != $refcnt) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | croak "Reference count of $self is increased from $refcnt to " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | . svref_2object($self)->REFCNT . "!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 200 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 126 | ▶ | sub render { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
render: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 126 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 126 | my $raw_bytes = $self->render_encoded(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 112 | ▶ | if ($self->{render_as_bytes}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 1 | $raw_bytes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 111 | decode(utf8 => $raw_bytes); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 133 | ▶ | sub parse_path_info { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_path_info: called CC=4 SCAR=15.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 133 | (my MY $self, my ($reqrec)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | # [$path_info, $subpage, $action] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 133 | ▶ | my ($path_info, @rest) = ref $reqrec ? @$reqrec : $reqrec; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 133 | $path_info =~ s,^/*,/,; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 133 | my ($tmpldir, $loc, $file, $trailer, $is_index) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | = my @pi = $self->lookup_split_path_info($path_info); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 133 | ▶ | unless (@pi) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 133 | ▶ | ($path_info, $tmpldir, $loc, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | (@rest ? [$file, @rest] : $file), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | , $self->pi_to_connection_quad(\@pi) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 133 | ▶ | sub prepare_processing_context { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare_processing_context: called CC=3 SCAR=12.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 133 | (my MY $self, my ($reqrec, $args)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | my ($path_info, $tmpldir, $loc, $widgetSpec, @rest) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 133 | ▶ | = $self->parse_path_info($reqrec) or do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 0 | die "No such location: ".terse_dump($reqrec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | 133 | ▶ | my $dh = $self->get_lochandler(map {untaint_any($_)} $loc, $tmpldir) or do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 0 | die "No such directory: $path_info"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | my $con = $self->make_connection | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | undef, @rest, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | , yatt => $dh, noheader => 1, path_info => $path_info, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | , encoding => $self->{output_encoding} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 133 | , $self->make_debug_params($reqrec, $args) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 133 | ($dh, $con, $widgetSpec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 126 | ▶ | sub render_encoded { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
render_encoded: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 126 | (my MY $self, my ($reqrec, $args, @opts)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 126 | my ($dh, $con, $widgetSpec) = $self->prepare_processing_context($reqrec, $args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 126 | $self->render_into_context($dh, $con, $widgetSpec, $args, @opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 112 | $con->buffer; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 0 | ▶ | sub render_into { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
render_into: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 0 | (my MY $self, my ($con, $reqrec, $args, @opts)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | my ($path_info, $tmpldir, $loc, $widgetSpec, @rest) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 0 | ▶ | = $self->parse_path_info($reqrec) or do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 0 | die "No such location: ".terse_dump($reqrec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 0 | ▶ | my $dh = $self->get_lochandler(map {untaint_any($_)} $loc, $tmpldir) or do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 0 | die "No such directory: $path_info"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 0 | $con->configure(yatt => $dh); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 0 | $self->render_into_context($dh, $con, $widgetSpec, $args, @opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | # Common context wrapper for the render path: sets $SYS/$YATT/$CON, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | # runs before/after_dirhandler (site_config entities) and the chdir | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | # guard, but does NOT install the __DIE__/__WARN__ traps - that is the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | # web handle path's intentional distinction (perl -d friendliness). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | # GH-267 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 126 | ▶ | sub render_into_context { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
render_into_context: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 126 | (my MY $self, my ($dh, $con, $widgetSpec, $args, @opts)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 126 | local ($SYS, $YATT, $CON) = ($self, $dh, $con); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | 126 | $self->before_dirhandler($dh, $con, lexpand($widgetSpec)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 126 | my $chdir_guard = $dh->chdir_guard; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 126 | $self->invoke_dirhandler | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | $dh, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | , render_into => $con | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | , $widgetSpec | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | , $args, @opts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 112 | $self->after_dirhandler($dh, $con, lexpand($widgetSpec)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 112 | YATT::Lite::Util::try_invoke($con, 'flush_headers'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 0 | ▶ | sub make_connection_for { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_connection_for: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | 0 | (my MY $self, my ($reqrec, $args, @other)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 0 | my ($path_info, $tmpldir, $loc, $widgetSpec, @rest) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | = $self->parse_path_info($reqrec); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | $self->make_connection | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | undef, @rest, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | , noheader => 1, path_info => $path_info, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | , encoding => $self->{output_encoding}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | 0 | , $self->make_debug_params($reqrec, $args), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | , @other, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 176 | ▶ | sub lookup_split_path_info { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lookup_split_path_info: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | 176 | (my MY $self, my $path_info) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | lookup_path($path_info | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | , $self->{_tmpldirs} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | , $self->{index_name} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | , $self->{ext_public} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 176 | , $self->{use_subpath}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | sub K_MOUNT_MATCH () { "__yatt" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | 32 | ▶ | sub lookup_psgi_mount { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lookup_psgi_mount: called CC=6 SCAR=18.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | 32 | (my MY $self, my $path_info) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | 32 | ▶ | $self->{_loc2psgi_re} // $self->rebuild_psgi_mount; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->{"_loc2psgi_re"} // $self->rebuild_psgi_mount
MC/DC0%0/2
$self->{"_loc2psgi_re"} // $self->rebuild_psgi_mount
$self->{"_loc2psgi_re"}
$self->rebuild_psgi_mount
Truth table66%2/3
A // B
A= $self->{"_loc2psgi_re"}B= $self->rebuild_psgi_mount
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | $path_info =~ $self->{_loc2psgi_re} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 32 | ▶ | or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 7 | ▶ | my @mount_match = grep {/^@{[K_MOUNT_MATCH()]}/o} keys %+ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 7 | ▶ | if (@mount_match >= 2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | croak "Multiple match found for psgi_mount: \n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 0 | . join("\n ", map {$self->{_loc2psgi_dict}{$_}[0]} @mount_match); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 7 | my $path_prefix = $+{$mount_match[0]}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | 7 | my $item = $self->{_loc2psgi_dict}{$path_prefix}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 7 | ▶ | wantarray ? @{$item}[1..$#$item] : $item->[2]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | 7 | ▶ | sub mount_psgi { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mount_psgi: called CC=4 SCAR=14.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 7 | (my MY $self, my ($path_prefix, $app, @opts)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | 7 | ▶ | unless (defined $path_prefix) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | 0 | croak "path_prefix is empty! mount_psgi(path_prefix, psgi_app)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 7 | ▶ | if (not ref $path_prefix) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 7 | $path_prefix =~ s,^/*,/,; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | 7 | ▶ | my $dict = $self->{_loc2psgi_dict} //= +{}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"_loc2psgi_dict"} //= {}
MC/DC100%1/1
$self->{"_loc2psgi_dict"} //= {}
$self->{"_loc2psgi_dict"}
Truth table100%2/2
A
A= $self->{"_loc2psgi_dict"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 7 | my $key = K_MOUNT_MATCH() . (keys %$dict); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | 7 | (my $strip = $path_prefix) =~ s,/\z,,; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | 7 | $dict->{$path_prefix} = [$key => $strip => $app, @opts]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 7 | undef $self->{_loc2psgi_re}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | # For cascading call | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 7 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | 7 | ▶ | sub rebuild_psgi_mount { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rebuild_psgi_mount: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | 7 | (my MY $self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 7 | my @re; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | 7 | foreach my $path_prefix (sort {length($b) <=> length($a)} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | 7 | ▶ | keys %{$self->{_loc2psgi_dict} //= +{}}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"_loc2psgi_dict"} //= {}
MC/DC0%0/1
$self->{"_loc2psgi_dict"} //= {}
$self->{"_loc2psgi_dict"}
Truth table50%1/2
A
A= $self->{"_loc2psgi_dict"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 20 | my ($key, undef, $app) = @{$self->{_loc2psgi_dict}{$path_prefix}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 20 | push @re, qr{(?<$key>$path_prefix)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | 7 | my $all = join("|", @re); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | 7 | $self->{_loc2psgi_re} = qr{^(?:$all)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 4 | ▶ | sub psgi_file_app { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
psgi_file_app: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 4 | my ($pack, $path) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | 4 | require Plack::App::File; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | 4 | Plack::App::File->new(root => $path)->to_app; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | 1 | ▶ | sub mount_static { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mount_static: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | 1 | (my MY $self, my ($location, $realpath)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 1 | ▶ | my $app = ref $realpath eq 'CODE' ? $realpath | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | : $self->psgi_file_app($realpath); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | 1 | $self->mount_psgi($location, $app); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | 43 | ▶ | sub mount_action { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mount_action: called CC=4 SCAR=15.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | 43 | (my MY $self, my ($path_info, $action)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | 43 | ▶ | if (my $ref = ref $path_info) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 0 | croak "mount_action doesn't support $ref path_info, sorry"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 43 | my ($tmpldir, $loc, $file, $trailer, $is_index) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | = my @pi = $self->lookup_split_path_info($path_info); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 43 | ▶ | unless (@pi) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | 0 | croak "Can't find acutal directory for $path_info"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | 43 | ▶ | unless ($is_index) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 0 | croak "Conflicting mount_action($path_info) with file=$file\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 43 | my $realdir = $tmpldir.$loc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | 43 | my $dh = $self->get_dirhandler($realdir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | 43 | $dh->set_action_handler($trailer, $action); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | # For cascading call. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 43 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | sub Connection () {'YATT::Lite::Connection'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 0 | ▶ | sub make_simple_connection { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_simple_connection: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | 0 | (my MY $self, my ($quad, @rest)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 0 | my @params = $self->pi_to_connection_quad($quad); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | 0 | $self->make_connection(undef, @params, @rest); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | 133 | ▶ | sub pi_to_connection_quad { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pi_to_connection_quad: called CC=3 SCAR=12.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 133 | (my MY $self, my ($pi)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 133 | my ($tmpldir, $loc, $file, $trailer, $is_index, $request_file) = @$pi; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | 133 | my $virtdir = "$self->{doc_root}$loc"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 133 | my $realdir = "$tmpldir$loc"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | # GH-251: When request_file is not given (e.g. synthetic quads), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | # default to the canonical (extension-less) form. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 133 | ▶ | $request_file //= $is_index ? '' : trim_ext($file, $self->{ext_public}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$request_file //= $is_index ? "" : trim_ext($file, $self->{"ext_public"})
MC/DC0%0/2
$request_file //= $is_index ? "" : trim_ext($file, $self->{"ext_public"})
$request_file
$is_index ? "" : trim_ext($file, $self->{"ext_public"})
Truth table33%1/3
A //= B
A= $request_fileB= $is_index ? "" : trim_ext($file, $self->{"ext_public"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | 133 | $self->connection_quad([$virtdir, $loc, $file, $trailer, $request_file]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | 133 | ▶ | sub make_debug_params { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_debug_params: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 133 | (my MY $self, my ($reqrec, $args)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | 133 | (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 680 | ▶ | sub make_connection { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_connection: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | 680 | (my MY $self, my ($fh, @params)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 680 | require YATT::Lite::Connection; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | $self->Connection->create( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | $fh, @params, system => $self, root => $self->{doc_root} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | 680 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | 2 | ▶ | sub finalize_connection {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
finalize_connection: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | 0 | ▶ | sub connection_param { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connection_param: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 0 | croak "Use of YATT::Lite::Factory::connection_param is deprecated!\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | 626 | ▶ | sub connection_quad { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connection_quad: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | 626 | (my MY $self, my ($quad)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | 626 | my ($virtdir, $loc, $file, $subpath, $request_file) = @$quad; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | 626 | ▶ | (dir => $virtdir | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | , location => $loc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | , file => $file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | , subpath => $subpath | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | , (defined $request_file ? (request_file => $request_file) : ())); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | # Hook for subclassing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | 495 | ▶ | sub run_dirhandler { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run_dirhandler: called CC=5 SCAR=16.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | 495 | (my MY $self, my ($dh, $con, $file)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | 495 | local ($SYS, $YATT, $CON) = ($self, $dh, $con); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | 495 | $self->before_dirhandler($dh, $con, $file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | 495 | my $result = $self->invoke_dirhandler( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | $dh, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | handle => $dh->cut_ext($file), $con, $file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | 360 | $self->after_dirhandler($dh, $con, $file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | 360 | ▶ | if (defined $result | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition55%5/9
defined $result and ref $result eq "CODE" || ref $result eq "ARRAY" && @$result == 3
ref $result eq "CODE" or ref $result eq "ARRAY" and @$result == 3
ref $result eq "ARRAY" and @$result == 3
MC/DC25%1/4
defined $result and ref $result eq "CODE" || ref $result eq "ARRAY" && @$result == 3
defined $result
ref $result eq "CODE"
ref $result eq "ARRAY"
@$result == 3
Truth table40%2/5
A and B or C and D
A= defined $resultB= ref $result eq "CODE"C= ref $result eq "ARRAY"D= @$result == 3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | and (ref $result eq 'CODE' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | or ref $result eq 'ARRAY' and @$result == 3)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | 3 | $self->raise_response($result) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | 612 | ▶ | sub before_dirhandler { &maybe::next::method; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
before_dirhandler: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | 479 | ▶ | sub after_dirhandler { &maybe::next::method; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
after_dirhandler: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 621 | ▶ | sub invoke_dirhandler { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
invoke_dirhandler: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | 621 | (my MY $self, my ($dh, $method, @args)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | 621 | $dh->with_system($self, $method, @args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | 7 | ▶ | sub invoke_sub_in { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
invoke_sub_in: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | 7 | (my MY $self, my ($reqrec, $args, $sub, @rest)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | 7 | my $wantarray = wantarray; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | 7 | my ($dh, $con, $widgetSpec) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | = $self->prepare_processing_context($reqrec, $args); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | 7 | local ($SYS, $YATT, $CON) = ($self, $dh, $con); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | 7 | $self->before_dirhandler($dh, $con, lexpand($widgetSpec)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | 7 | my @result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | 7 | ▶ | if ($wantarray) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | 4 | @result = $sub->($dh, $con, @rest); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | 3 | $result[0] = $sub->($dh, $con, @rest); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | 7 | $self->after_dirhandler($dh, $con, lexpand($widgetSpec)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | 7 | YATT::Lite::Util::try_invoke($con, 'flush_headers'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | 7 | ▶ | $wantarray ? @result : $result[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | 750 | ▶ | sub get_lochandler { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_lochandler: called CC=3 SCAR=12.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | 750 | (my MY $self, my ($location, $tmpldir)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | 750 | ▶ | $tmpldir //= $self->{doc_root}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$tmpldir //= $self->{"doc_root"}
MC/DC0%0/2
$tmpldir //= $self->{"doc_root"}
$tmpldir
$self->{"doc_root"}
Truth table66%2/3
A //= B
A= $tmpldirB= $self->{"doc_root"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | 750 | ▶ | $self->get_yatt($location) || do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | 0 | $self->{_loc2yatt}{$location} = $self->load_yatt("$tmpldir$location"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | # location => yatt (dirhandler, dirapp) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | 989 | ▶ | sub get_yatt { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_yatt: called CC=3 SCAR=11.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | 989 | (my MY $self, my $loc) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | 989 | ▶ | if (my $yatt = $self->{_loc2yatt}{$loc}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | 1 | return $yatt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | # print STDERR Carp::longmess("get_yatt for $loc" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | # , YATT::Lite::Util::terse_dump($self->{_tmpldirs})); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | 988 | my ($realdir, $basedir) = lookup_dir(trim_slash($loc), $self->{_tmpldirs}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | 988 | ▶ | unless ($realdir) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | 0 | $self->error("Can't find template directory for location '%s'", $loc); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | 988 | $self->{_loc2yatt}{$loc} = $self->load_yatt($realdir, $basedir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | # phys-path => yatt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | 72 | *get_dirhandler = *load_yatt; *get_dirhandler = *load_yatt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | 1386 | ▶ | sub load_yatt { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_yatt: called CC=11 SCAR=25.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | 1386 | (my MY $self, my ($path, $basedir, $visits, $from)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | 1386 | ▶ | unless (defined $path and $path ne '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $path and $path ne ""
MC/DC0%0/2
defined $path and $path ne ""
defined $path
$path ne ""
Truth table33%1/3
A and B
A= defined $pathB= $path ne ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | 0 | croak "empty path for load_yatt!" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | 1386 | $path = $self->rel2abs($path, $self->{app_root}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | 1386 | ▶ | if (my $yatt = $self->{_path2yatt}{$path}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | 1100 | return $yatt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | 286 | ▶ | unless (-e $path) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | 0 | croak "Can't load YATT directory '$path'! No such directory!"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | 286 | ▶ | if (not $visits) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | 246 | $visits = Visits->start($path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | } elsif (my $preds = $visits->check_cycle($path, $from)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | 1 | $self->error("Template config error! base has cycle!:\n %s\n" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | , join "\n -> ", $from, @$preds); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | #-- DFS-visits -- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | 285 | ▶ | if (not $self->{allow_missing_dir} and not -d $path) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"allow_missing_dir"} or -d $path
MC/DC0%0/2
$self->{"allow_missing_dir"} or -d $path
$self->{"allow_missing_dir"}
-d $path
Truth table33%1/3
A or B
A= $self->{"allow_missing_dir"}B= -d $path
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | 0 | croak "Can't find '$path'!"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | 285 | ▶ | if (my (@cf) = $self->list_config_files(untaint_any($path)."/.htyattconfig")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | 20 | ▶ | $self->error("Multiple configuration files!", @cf) if @cf > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | 20 | ▶ | _with_loading_file {$self} $cf[0], sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | 20 | $self->build_yatt($path, $basedir, $visits, $self->read_file($cf[0])); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | 20 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | 265 | $self->build_yatt($path, $basedir, $visits); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | 285 | ▶ | sub build_yatt { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_yatt: called CC=9 SCAR=22.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | 285 | (my MY $self, my ($path, $basedir, $visits, %opts)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | 285 | trim_slash($path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | 285 | my $app_name = $self->app_name_for($path, $basedir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | # base package と base vfs object の決定 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | 285 | my (@basepkg, @basevfs); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | 285 | $self->_list_base_spec_in($path, delete $opts{base}, $visits | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | , \@basepkg, \@basevfs); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | 282 | my $app_ns = $self->buildns(my @log = (INST => \@basepkg, $path)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | 282 | print STDERR "# Factory::buildns(" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | , terse_dump(@log), ") => $app_ns\n" if DEBUG_FACTORY; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | 282 | my $has_rc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | 282 | ▶ | if ($has_rc = (-e (my $rc = "$path/.htyattrc.pl"))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | # Note: This can do "use fields (...)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | 17 | dofile_in($app_ns, $rc); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | 17 | print STDERR "# Loaded: $rc\n" if DEBUG_FACTORY; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | 282 | my @vfs_opts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | 282 | ▶ | if (defined(my $prefix = $self->page_prefix_for($path))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | 248 | push @vfs_opts, page_prefix => $prefix; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | my @args = (vfs => [dir => $path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | , entns => $self->{_path2entns}{$path} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | , encoding => $self->{tmpl_encoding} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | , @vfs_opts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | , @basevfs ? (base => \@basevfs) : ()] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | , dir => $path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | , app_ns => $app_ns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | , app_name => $app_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | , factory => $self | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | # XXX: Design flaw! Use of tmpl_cache will cause problem. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | # because VFS->create for base do not respect Factory->get_yatt. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | # To solve this, I should redesign all Factory/VFS related stuffs. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | , tmpl_cache => $self->{_tmpl_cache} //= {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | , entns2vfs_item => $self->{_entns2vfs_item} //= {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | 282 | ▶ | , $self->configparams_for(fields_hash($app_ns))); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%4/4
$self->{"_tmpl_cache"} //= {}
$self->{"_entns2vfs_item"} //= {}
MC/DC100%1/1
$self->{"_tmpl_cache"} //= {}
$self->{"_tmpl_cache"}
MC/DC100%1/1
$self->{"_entns2vfs_item"} //= {}
$self->{"_entns2vfs_item"}
Truth table100%2/2
A
A= $self->{"_tmpl_cache"}
Truth table100%2/2
A
A= $self->{"_entns2vfs_item"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | 282 | ▶ | if (my @unk = $app_ns->YATT::Lite::Object::cf_unknowns(%opts)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | 0 | $self->error("Unknown option for yatt app '%s': '%s'" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | , $path, join(", ", @unk)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | 282 | printf STDERR "build_yatt.before_app_ns_new: refcnt=%d\n", svref_2object($self)->REFCNT if DEBUG_REFCNT && DEBUG_FACTORY; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | 282 | my $yatt = $self->{_path2yatt}{$path} = $app_ns->new(@args, %opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | 282 | printf STDERR "build_yatt.after_app_ns_new: refcnt=%d\n", svref_2object($self)->REFCNT if DEBUG_REFCNT && DEBUG_FACTORY; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | 282 | ▶ | unless ($yatt->after_new_is_called) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | 0 | Carp::croak("after_new is not called for $path!"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | 282 | ▶ | if ($has_rc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | 17 | print STDERR "# setting up rc actions\n" if DEBUG_FACTORY; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | 17 | $yatt->setup_rc_actions; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | 282 | $yatt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | 285 | ▶ | sub _list_base_spec_in { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_list_base_spec_in: called CC=18 SCAR=29.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | 285 | (my MY $self, my ($in, $desc, $visits, $basepkg, $basevfs)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | print STDERR "# Factory::list_base_in(" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | 285 | , terse_dump($in, $desc, $self->{app_base}), ")\n" if DEBUG_FACTORY; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | # YATT::Lite->base can be either specified explicitly | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | # or implicitly copied from YATT::Lite::Factory->app_base. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | # Later case can lead circular inheritance for app_base itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | # To avoid this, $is_implicit flag is used. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | 285 | my $is_implicit = not defined $desc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | 285 | ▶ | $desc //= $self->{app_base}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$desc //= $self->{"app_base"}
MC/DC100%2/2
$desc //= $self->{"app_base"}
$desc
$self->{"app_base"}
Truth table100%3/3
A //= B
A= $descB= $self->{"app_base"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | # First item in base is treated *primary* base. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | # Rest of them are treated mixin. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | 285 | ▶ | my ($base, @mixin) = lexpand($desc) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | # This builds [$package => $path] pairs and separately store | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | # as primary and mixin. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | 80 | my (@primary_pair, @mixin_pair); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | 80 | foreach my $task ([1, $base], [0, @mixin]) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | 160 | my ($is_primary, @spec) = @$task; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | 160 | foreach my $basespec (@spec) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | 99 | my ($pkg, $yatt); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | 99 | ▶ | if ($basespec =~ /^::(.*)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | 5 | ckrequire($1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | 5 | ▶ | push @{$is_primary ? \@primary_pair : \@mixin_pair}, [$1, undef]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | } elsif (my $realpath = $self->app_path_find_dir_in($in, $basespec)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | 94 | ▶ | if ($is_implicit) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | # Simply drop circular inheritance for implicit case. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | 58 | ▶ | next if $visits->has_node($realpath); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | 66 | $visits->ensure_make_node($realpath); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | 66 | ▶ | push @{$is_primary ? \@primary_pair : \@mixin_pair}, [undef, $realpath]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | 0 | $self->error("Invalid base spec: %s", $basespec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | # This builds $basevfs for YATT::Lite::VFS::Folder::vivify_base_descs() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | # This preallocates YATT::Lite and its entns for each realpath. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | 80 | foreach my $pair (@primary_pair, @mixin_pair) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | 71 | my ($pkg, $dir) = @$pair; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | 71 | ▶ | next unless $dir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | 66 | my $yatt = $self->load_yatt($dir, undef, $visits, $in); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | 63 | $pair->[0] = ref $yatt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | 63 | my $realdir = $yatt->cget('dir'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | 63 | push @$basevfs, [dir => $realdir, entns => $self->{_path2entns}{$realdir}]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | # This builds $basepkg for buildns() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | 77 | ▶ | push @$basepkg, map {defined $_->[0] ? $_->[0] : ()} do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | 77 | ▶ | if (not $self->{no_mro_c3}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | 77 | my %known_pkg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | 77 | foreach my $pair (grep {defined $_->[0]} @primary_pair) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | 49 | $known_pkg{$_} = 1 for @{mro::get_linear_isa($pair->[0])}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | 77 | ▶ | (grep(!$_->[0] || !$known_pkg{$_->[0]}, @mixin_pair) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$_->[0] && $known_pkg{$_->[0]}
MC/DC50%1/2
$_->[0] && $known_pkg{$_->[0]}
$_->[0]
$known_pkg{$_->[0]}
Truth table66%2/3
A && B
A= $_->[0]B= $known_pkg{$_->[0]}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | , @primary_pair); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | 0 | @primary_pair; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | 77 | $visits->finish_node($in); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | 5 | ▶ | sub get_yatt_by_entns { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_yatt_by_entns: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | 5 | (my MY $self, my $entns) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | 5 | $self->{_entns2vfs_item}{$entns}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | 282 | ▶ | sub buildns { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
buildns: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | 282 | (my MY $self, my ($kind, $baselist, $path)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | 282 | my $newns = $self->SUPER::buildns($kind, $baselist, $path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | # EntNS を足し、Entity も呼べるようにする。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | $self->{_default_app}->define_Entity(undef, $newns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | 282 | , map {$_->EntNS} @$baselist); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | # instns には MY を定義しておく。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | 282 | my $my = globref($newns, 'MY'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | 282 | ▶ | unless (*{$my}{CODE}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | 282 | define_const($my, $newns); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | # もし $newns の EntNS が Factory(SiteApp, app.psgi) の EntNS を継承していない | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | # なら、継承する | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | 282 | ▶ | unless ($newns->EntNS->isa($self->EntNS)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | 5 | push @{globref_default(globref($newns->EntNS, 'ISA') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | , [])}, $self->EntNS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | # basevfs に entns を渡せるように。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | 282 | $self->{_path2entns}{$path} = $newns->EntNS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | 282 | $newns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | 283 | ▶ | sub _cf_delegates { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_cf_delegates: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | 283 | qw(no_unicode | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | no_unicode_params | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | output_encoding | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | header_charset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | tmpl_encoding | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | render_as_bytes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | debug_cgen | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | at_done | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | app_root | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | namespace | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | index_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | ext_public | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | ext_private | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | only_parse | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | use_subpath | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | dont_map_args | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | dont_debug_param | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | always_refresh_deps | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | no_mro_c3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | die_in_error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | special_entities | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | default_lang | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | no_lineinfo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | ext_pattern | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1277 | debug_parser | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1278 | check_lineno | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1279 | match_argsroute_first | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1280 | stash_unknown_params_to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1281 | body_argument | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1282 | body_argument_type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1283 | prefer_call_for_entity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1284 | no_conditional_call | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1285 | allow_bare_entity_in_decl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1286 | no_chdir | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1287 | pagevars | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1288 | argmacro | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1289 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1290 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1292 | 282 | ▶ | sub configparams_for { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
configparams_for: called CC=3 SCAR=12.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1293 | 282 | (my MY $self, my $hash) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1294 | # my @base = map { [dir => $_] } lexpand($self->{tmpldirs}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1295 | # (@base ? (base => \@base) : ()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1296 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1297 | 282 | my $debugging = YATT::Lite::Util::is_debugging(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1298 | 282 | ▶ | if ($debugging) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1299 | 0 | print STDERR "# Note: Factory->die_in_error is turned off for debugging\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1300 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1301 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1302 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1303 | $self->cf_delegate_known(0, $hash, $self->_cf_delegates) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1304 | , (exists $hash->{error_handler} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1305 | 282 | ▶ | ? (error_handler => \ $self->{error_handler}) : ()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1306 | , die_in_error => ! $debugging | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1307 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1308 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1310 | # XXX: Should have better interface. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1311 | 1 | ▶ | sub error { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
error: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1312 | 1 | (my MY $self, my ($fmt, @args)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1313 | 1 | croak sprintf $fmt, @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1314 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1316 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1318 | 285 | ▶ | sub app_name_for { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
app_name_for: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1319 | 285 | (my MY $self, my ($path, $basedir)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1320 | 285 | ensure_slash($path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1321 | 285 | ▶ | if ($basedir) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1322 | 235 | ensure_slash($basedir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1323 | 235 | ▶ | $self->_extract_app_name($path, $basedir) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->_extract_app_name($path, $basedir) // $self->error("Can't extract app_name path=%s, base=%s", $path, $basedir)
MC/DC0%0/2
$self->_extract_app_name($path, $basedir) // $self->error("Can't extract app_name path=%s, base=%s", $path, $basedir)
$self->_extract_app_name($path, $basedir)
$self->error("Can't extract app_name path=%s, base=%s", $path, $basedir)
Truth table33%1/3
A // B
A= $self->_extract_app_name($path, $basedir)B= $self->error("Can't extract app_name path=%s, base=%s", $path, $basedir)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1324 | // $self->error("Can't extract app_name path=%s, base=%s" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1325 | , $path, $basedir); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1326 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1327 | 50 | foreach my $tmpldir (lexpand($self->{_tmpldirs})) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1328 | 50 | ensure_slash(my $cp = $tmpldir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1329 | 50 | ▶ | if (defined(my $app_name = $self->_extract_app_name($path, $cp))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1330 | # Can be empty string. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1331 | 16 | return $app_name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1332 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1333 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1334 | 34 | return ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1335 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1336 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1338 | # Prefix of page names in the directory $path: '' for a template dir | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1339 | # itself, 'sub/' for its subdirectory, undef when $path is not under | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1340 | # any template dir (ie. not a page directory, eg. ytmpl). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1341 | 282 | ▶ | sub page_prefix_for { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
page_prefix_for: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1342 | 282 | (my MY $self, my $path) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1343 | 282 | ensure_slash($path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1344 | 282 | foreach my $tmpldir (lexpand($self->{_tmpldirs})) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1345 | 282 | ensure_slash(my $cp = $tmpldir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1346 | 282 | ▶ | if (defined(my $rel = $self->_extract_app_name($path, $cp))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1347 | 248 | ▶ | return $rel eq '' ? '' : "$rel/"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1348 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1349 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1350 | 34 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1351 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1352 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1353 | 570 | ▶ | sub _extract_app_name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_extract_app_name: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1354 | 570 | (my MY $self, my ($path, $basedir)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1355 | 570 | my ($bs, $name) = unpack('A'.length($basedir).'A*', $path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1356 | 570 | ▶ | return undef unless $bs eq $basedir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1357 | 501 | $name =~ s{[/\\]+$}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1358 | 501 | $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1359 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1361 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1363 | 36 | ▶ | sub read_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read_file: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1364 | 36 | (my MY $self, my $fn) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1365 | 36 | ▶ | my ($ext) = $fn =~ /\.(\w+)$/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1366 | or croak "Can't extract fileext from filename: $fn"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1367 | 36 | ▶ | my $sub = $self->can("read_file_$ext") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1368 | or croak "filetype $ext is not supported: $fn"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1369 | 36 | $sub->($self, $fn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1370 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1371 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1372 | 949 | ▶ | sub default_config_filetypes {qw/xhf yml/} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_config_filetypes: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1373 | 949 | ▶ | sub config_filetypes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
config_filetypes: called CC=3 SCAR=12.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1374 | 949 | (my MY $self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1375 | 949 | ▶ | if (ref $self and my $item = $self->{config_filetypes}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $self and my $item = $self->{"config_filetypes"}
MC/DC0%0/2
ref $self and my $item = $self->{"config_filetypes"}
ref $self
my $item = $self->{"config_filetypes"}
Truth table66%2/3
A and B
A= ref $selfB= my $item = $self->{"config_filetypes"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1376 | 0 | lexpand($item) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1377 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1378 | 949 | $self->default_config_filetypes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1379 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1380 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1381 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1382 | 1218 | ▶ | sub find_unique_config_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_unique_config_file: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1383 | 1218 | (my MY $self, my ($base_path, @rest)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1384 | 1218 | ▶ | return if grep {not defined} $base_path, @rest; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1385 | 640 | my @cf = $self->list_config_files(join("", $base_path, @rest)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1386 | 640 | ▶ | $self->error("Multiple configuration files!", @cf) if @cf > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1387 | 640 | ▶ | return $cf[0] if @cf; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1388 | 630 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1389 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1390 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1391 | 949 | ▶ | sub list_config_files { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list_config_files: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1392 | 949 | (my MY $self, my $base_path) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1393 | map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1394 | 949 | my $cf = "$base_path.$_"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1395 | 1898 | ▶ | -e $cf ? $cf : () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1396 | } $self->config_filetypes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1397 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1398 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1399 | 29 | ▶ | sub read_file_xhf { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read_file_xhf: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1400 | 29 | (my MY $self, my $fn) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1401 | 29 | ▶ | my $bytes_semantics = ref $self && $self->{binary_config}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
ref $self && $self->{'binary_config'}
MC/DC0%0/2
ref $self && $self->{'binary_config'}
ref $self
$self->{'binary_config'}
Truth table66%2/3
A && B
A= ref $selfB= $self->{'binary_config'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1402 | 29 | $self->YATT::Lite::XHF::read_file_xhf | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1403 | ($fn, bytes => $bytes_semantics); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1404 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1406 | 7 | ▶ | sub read_file_yml { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read_file_yml: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1407 | 7 | (my MY $self, my $fn) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1408 | 7 | require YAML::Tiny; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1409 | 7 | my $yaml = YAML::Tiny->read($fn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1410 | 6 | ▶ | unless (defined $yaml) { # YAML::Tiny old version doesn't raise error. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1411 | 0 | Carp::croak(YAML::Tiny->errstr . ""); # errstr is deprecated, but only old version can reach this line. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1412 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1413 | 6 | ▶ | wantarray ? lexpand($yaml->[0]) : $yaml->[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1414 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1415 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1416 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1417 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1418 | 1473 | ▶ | sub trim_slash { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
trim_slash: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1419 | 1473 | $_[0] =~ s,/*$,,; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1420 | 1473 | $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1421 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1422 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1423 | 1134 | ▶ | sub ensure_slash { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ensure_slash: called CC=4 SCAR=15.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1424 | 1134 | ▶ | unless (defined $_[0] and $_[0] ne '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $_[0] and $_[0] ne ""
MC/DC0%0/2
defined $_[0] and $_[0] ne ""
defined $_[0]
$_[0] ne ""
Truth table33%1/3
A and B
A= defined $_[0]B= $_[0] ne ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1425 | 0 | $_[0] = '/'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1426 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1427 | 1134 | my $abs = File::Spec->rel2abs($_[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1428 | 1134 | ▶ | my $sep = $^O =~ /^MSWin/ ? "\\" : "/"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1429 | 1134 | $abs =~ s{(?:\Q$sep\E)?$}{$sep}; # Should end with path-separator. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1430 | 1134 | $_[0] = $abs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1431 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1432 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1433 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1434 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1435 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1436 | 72 | ▶ | Entity site_prefix => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=2.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1437 | 0 | my MY $self = $SYS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1438 | 0 | $self->{site_prefix}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1439 | 72 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1440 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1441 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1442 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1443 | 72 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||