| 1 | package YATT::Lite::Core; sub MY () {__PACKAGE__} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 77 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 77 | ▶ | use warnings qw(FATAL all NONFATAL misc); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 77 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 77 | ▶ | use constant DEBUG_REBUILD => $ENV{DEBUG_YATT_REBUILD}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 77 | ▶ | use parent qw(YATT::Lite::VFS); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 77 | ▶ | use YATT::Lite::MFields qw/namespace debug_cgen no_lineinfo check_lineno | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | index_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | tmpl_encoding | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | debug_parser | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | parse_while_loading only_parse | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | die_in_error error_handler | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | special_entities | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | lcmsg_sink | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | match_argsroute_first | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | body_argument | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | body_argument_type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | allow_bare_entity_in_decl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | stash_unknown_params_to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | prefer_call_for_entity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | no_conditional_call | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | pagevars | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | argmacro | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | _argmacro_registry | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | _argmacro_module_cache | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | _n_compiles | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 77 | /; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 77 | ▶ | use YATT::Lite::Util; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 77 | ▶ | use YATT::Lite::Constants; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 77 | ▶ | use YATT::Lite::Entities; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | # XXX: YATT::Lite に? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 77 | ▶ | use YATT::Lite::Breakpoint (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | # 以下、 package YATT::Lite のための、内部クラス | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 77 | ▶ | use YATT::Lite::VFS qw(Folder Item); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | use YATT::Lite::Types | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 77 | ▶ | ([Part => -base => MY->Item | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | , -fields => [qw(_toks _arg_dict _arg_order | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | _argmacro_instance_dict | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | _argmacro_instance_list | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | _argmacro_trigger_dict | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | _argmacro_output_dict | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | _decllist | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | namespace kind folder data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | decl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | implicit suppressed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | startln bodyln endln | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | startpos bodypos bodylen | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | subpattern | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | yatt_no_last_newline | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | )] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | , -constants => [[public => 0]] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | , [Widget => -fields => [qw(_tree _var_dict _has_required_arg)] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | , [Page => (), -constants => [[public => 1]]]] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | , [Action => (), -constants => [[public => 1], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | [item_category => 'do'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | ]] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | , [Data => ()] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | , [Entity => () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | , -constants => [[item_category => 'entity']] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | , [ArgMacro => () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | , -fields => [qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | output_args | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | _on_declare | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | _on_expand | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | to_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | from_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | rename_map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | resolve_map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | refer_names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | )] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | # <!yatt:import> が作る alias Part。実体は持たず、lookup 時に | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | # ソース側 Part へ解決される (resolve_alias)。GH-256 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | , [Import => () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | , -fields => [qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | imported_kind | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | src_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | src_folder | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | )] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | , [Template => -base => MY->File | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | , -alias => 'vfs_file' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | , -constants => [[can_generate_code => 1]] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | , -fields => [qw(_product _parse_ok | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | mtime utf8 age | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | usage constants | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | ignore_trailing_newlines | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | subroutes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | _decl_parsing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | )]] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | , [ParsingState => -fields => [qw(_startln _endln | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | _startpos _curpos | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | )]] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | , [AbstParser => -fields => [qw(body_argument | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | body_argument_type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | )]] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 77 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | sub YATT::Lite::Core::Part::public_name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
public_name: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | (my Part $part) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | $part->{name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 4 | ▶ | sub YATT::Lite::Core::Part::decl_kind { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
decl_kind: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 4 | (my Part $part) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 4 | join(":", $part->{namespace}, $part->{decl}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 4 | ▶ | sub YATT::Lite::Core::Part::syntax_keyword { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
syntax_keyword: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 4 | (my Part $part) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 4 | join(" ", $part->decl_kind, $part->syntax_name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 77 | *YATT::Lite::Core::Part::syntax_name = *YATT::Lite::Core::Part::public_name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 77 | *YATT::Lite::Core::Part::syntax_name = *YATT::Lite::Core::Part::public_name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 3 | ▶ | sub YATT::Lite::Core::Widget::syntax_name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
syntax_name: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 3 | (my Widget $widget) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 3 | ▶ | $widget->{decl} eq 'args' ? () : $widget->{name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 1 | ▶ | sub YATT::Lite::Core::Action::syntax_name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
syntax_name: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 1 | (my Action $action) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 1 | ▶ | $action->{name} eq '' ? q{''} : $action->{name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 3 | ▶ | sub YATT::Lite::Core::Widget::callsite_name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
callsite_name: called CC=2 SCAR=8.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 3 | (my Widget $widget) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 3 | ▶ | if ($widget->{decl} eq 'args') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | my Template $tmpl = $widget->{folder}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | join(":", $widget->{namespace}, $tmpl->{name}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 3 | join(":", $widget->{namespace}, $widget->{name}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | # item_key / method_name の符号化 (do\0 / entity\0, render_ / do_ / entity_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | # は各 part class の class メソッド *_for($name) に集約する。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | # instance メソッドはそこへ委譲するだけ。GH-256 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | sub YATT::Lite::Core::Part::method_name {...} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
method_name: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 425 | ▶ | sub YATT::Lite::Core::Widget::method_name_for {"render_$_[1]"} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
method_name_for: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 97 | ▶ | sub YATT::Lite::Core::Widget::method_name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
method_name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 97 | (my Widget $widget) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 97 | $widget->method_name_for($widget->{name}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 21 | ▶ | sub YATT::Lite::Core::Action::method_name_for {"do_$_[1]"} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
method_name_for: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 5 | ▶ | sub YATT::Lite::Core::Action::method_name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
method_name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 5 | (my Action $action) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 5 | $action->method_name_for($action->{name}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 70 | ▶ | sub YATT::Lite::Core::Action::item_key_for {"do\0$_[1]"} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
item_key_for: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 17 | ▶ | sub YATT::Lite::Core::Action::item_key { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
item_key: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 17 | (my Action $action) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 17 | $action->item_key_for($action->{name}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 366 | ▶ | sub YATT::Lite::Core::Entity::method_name_for {"entity_$_[1]"} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
method_name_for: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 4 | ▶ | sub YATT::Lite::Core::Entity::method_name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
method_name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 4 | (my Entity $entity) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 4 | $entity->method_name_for($entity->{name}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 438 | ▶ | sub YATT::Lite::Core::Entity::item_key_for {"entity\0$_[1]"} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
item_key_for: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 18 | ▶ | sub YATT::Lite::Core::Entity::item_key { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
item_key: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 18 | (my Entity $entity) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 18 | $entity->item_key_for($entity->{name}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | # <!yatt:import> の alias Part (GH-256) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | # kind 名 → part class の登録簿。_Item 系の名前空間を持つ kind のみ。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | # (argmacro は _argmacro_dict 系なので含めない) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 77 | our %PART_KIND_CLASS | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | = (widget => Widget, page => Page, action => Action, entity => Entity); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 91 | ▶ | sub YATT::Lite::Core::Import::part_class_of_imported_kind { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
part_class_of_imported_kind: called CC=3 SCAR=13.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 91 | (my Import $import) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 91 | ▶ | $PART_KIND_CLASS{$import->{imported_kind} // ''} // YATT::Lite::Core->Item; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
$YATT::Lite::Core::PART_KIND_CLASS{$import->{"imported_kind"} // ""} // "YATT::Lite::Core"->Item
$import->{"imported_kind"} // ""
MC/DC0%0/2
$YATT::Lite::Core::PART_KIND_CLASS{$import->{"imported_kind"} // ""} // "YATT::Lite::Core"->Item
$YATT::Lite::Core::PART_KIND_CLASS{$import->{"imported_kind"} // ""}
"YATT::Lite::Core"->Item
MC/DC0%0/1
$import->{"imported_kind"} // ""
$import->{"imported_kind"}
Truth table33%1/3
A // B
A= $YATT::Lite::Core::PART_KIND_CLASS{$import->{"imported_kind"} // ""}B= "YATT::Lite::Core"->Item
Truth table50%1/2
A
A= $import->{"imported_kind"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 19 | ▶ | sub YATT::Lite::Core::Import::method_name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
method_name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 19 | (my Import $import) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 19 | $import->part_class_of_imported_kind->method_name_for($import->{name}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 20 | ▶ | sub YATT::Lite::Core::Import::item_key { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
item_key: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 20 | (my Import $import) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 20 | $import->part_class_of_imported_kind->item_key_for($import->{name}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 52 | ▶ | sub YATT::Lite::Core::Import::src_item_key { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
src_item_key: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 52 | (my Import $import) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 52 | $import->part_class_of_imported_kind->item_key_for($import->{src_name}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 18 | ▶ | sub YATT::Lite::Core::Import::public { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
public: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 18 | (my Import $import) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 18 | my Part $part = eval { $import->resolve_alias }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 18 | ▶ | $part ? $part->public : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | # alias をソース側 Part へ解決する。$vfs が渡されたときは | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | # ソース template の refresh も行う (常に最新のメタ情報を返すため)。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 52 | ▶ | sub YATT::Lite::Core::Import::resolve_alias { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resolve_alias: called CC=8 SCAR=25.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 52 | (my Import $import, my $vfs) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | my Template $src = $import->{src_folder} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 52 | ▶ | or croak "import source template is gone (for part '$import->{name}')"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 52 | ▶ | if ($vfs) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | $src->refresh($vfs) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 34 | ▶ | unless $vfs->{mark}{Scalar::Util::refaddr($src)}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 52 | my $key = $import->src_item_key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | my $item = $src->{_Item}{$key} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | // ($vfs ? $vfs->find_part_from($src, $key) : undef) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | or croak "No such part '$import->{src_name}' in " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | . ($src->{path} // $src->{name}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 52 | ▶ | . " (imported as '$import->{name}')"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%1/6
$src->{"_Item"}{$key} // ($vfs ? $vfs->find_part_from($src, $key) : undef)
$src->{"path"} // $src->{"name"}
MC/DC0%0/2
$src->{"_Item"}{$key} // ($vfs ? $vfs->find_part_from($src, $key) : undef)
$src->{"_Item"}{$key}
($vfs ? $vfs->find_part_from($src, $key) : undef)
MC/DC0%0/2
$src->{"path"} // $src->{"name"}
$src->{"path"}
$src->{"name"}
Truth table33%1/3
A // B
A= $src->{"_Item"}{$key}B= ($vfs ? $vfs->find_part_from($src, $key) : undef)
Truth table0%0/3
A // B
A= $src->{"path"}B= $src->{"name"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | # import の import (再輸出) も解決する。循環は宣言時に禁止済み。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 52 | $item->resolve_alias($vfs); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 572 | ▶ | sub YATT::Lite::Core::Template::list_import_sources { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list_import_sources: called CC=6 SCAR=18.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 572 | (my Template $tmpl) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 572 | my (%seen, @result); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 572 | ▶ | foreach my Part $part (@{$tmpl->{_partlist} || []}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$tmpl->{'_partlist'} || []
MC/DC0%0/1
$tmpl->{'_partlist'} || []
$tmpl->{'_partlist'}
Truth table50%1/2
A
A= $tmpl->{'_partlist'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 912 | ▶ | next unless UNIVERSAL::isa($part, Import); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 19 | my Import $import = $part; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 19 | ▶ | my Folder $src = $import->{src_folder} or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 19 | ▶ | next if $seen{Scalar::Util::refaddr($src)}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 17 | push @result, $src; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 572 | @result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 1018 | ▶ | sub YATT::Lite::Core::Part::configure_folder { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
configure_folder: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 1018 | (my Part $part, my Folder $folder) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 1018 | Scalar::Util::weaken($part->{folder} = $folder); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | # die "Can't weaken!" unless Scalar::Util::isweak($part->{folder}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | # "%name;" or "%name(to=from);" (for error messages) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 5 | ▶ | sub YATT::Lite::Core::ArgMacro::call_spec { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
call_spec: called CC=3 SCAR=11.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 5 | (my ArgMacro $argmacro) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | '%' . $argmacro->{name} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | . ($argmacro->{to_name} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 5 | ▶ | ? "($argmacro->{to_name}=" . ($argmacro->{from_name} // '') . ")" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$argmacro->{"from_name"} // ""
MC/DC0%0/1
$argmacro->{"from_name"} // ""
$argmacro->{"from_name"}
Truth table50%1/2
A
A= $argmacro->{"from_name"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | : '') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | . ';'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 60 | ▶ | sub YATT::Lite::Core::ArgMacro::clone_with_renamespec { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone_with_renamespec: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 60 | (my ArgMacro $orig, my ($toName, $fromName)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 60 | my ArgMacro $new = fields::new(ArgMacro); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 60 | %$new = %$orig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 60 | Scalar::Util::weaken($new->{folder}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 60 | $new->{output_args} = YATT::Lite::Util::deep_copy_array($orig->{output_args}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 60 | $new->{to_name} = $toName; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 60 | $new->{from_name} = $fromName; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 60 | $new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | # sub YATT::Lite::Core::Part::source { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | # (my Part $part) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | # join "", map {ref $_ ? "\n" x $$_[0] : $_} @{$part->{source}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | ▶ | sub YATT::Lite::Core::Template::source_length { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
source_length: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | (my Template $self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | length $self->{string}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 686 | ▶ | sub YATT::Lite::Core::Template::list_parts { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list_parts: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 686 | (my Template $self, my $type) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 686 | ▶ | return unless $self->{_partlist}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 686 | ▶ | return @{$self->{_partlist}} unless defined $type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 597 | grep { UNIVERSAL::isa($_, $type) } @{$self->{_partlist}} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | ▶ | sub YATT::Lite::Core::Template::widget_list { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
widget_list: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | (my Template $self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | $self->list_parts(Widget); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 12 | ▶ | sub YATT::Lite::Core::Template::node_source { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
node_source: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 12 | (my Template $tmpl, my $node) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 12 | ▶ | unless (ref $node eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | confess "Node is not an ARRAY"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 12 | $tmpl->source_region($node->[NODE_BEGIN], $node->[NODE_END]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 189 | ▶ | sub YATT::Lite::Core::Template::node_body_source { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
node_body_source: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 189 | (my Template $tmpl, my $node) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 189 | ▶ | unless (ref $node eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | confess "Node is not an ARRAY"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 189 | $tmpl->source_region($node->[NODE_BODY_BEGIN], $node->[NODE_BODY_END]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 1 | ▶ | sub YATT::Lite::Core::Template::node_outer_source { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
node_outer_source: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 1 | (my Template $tmpl, my $node) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 1 | ▶ | unless (ref $node eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | confess "Node is not an ARRAY"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 1 | $tmpl->source_region($node->[NODE_BEGIN], $node->[NODE_BODY_END]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 207 | ▶ | sub YATT::Lite::Core::Template::source_region { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
source_region: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 207 | (my Template $tmpl, my ($begin, $end)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 207 | $tmpl->source_substr($begin, $end - $begin); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 244 | ▶ | sub YATT::Lite::Core::Template::source_substr { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
source_substr: called CC=3 SCAR=12.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 244 | (my Template $tmpl, my ($offset, $len)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 244 | ▶ | unless (defined $len) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | substr $tmpl->{string}, $offset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 244 | ▶ | return undef if $len < 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 244 | substr $tmpl->{string}, $offset, $len; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | # source_substr ベースの part (action/entity) の本体抽出。GH-258 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | # (bodypos, bodylen) 区間内の yatt コメント span は「同じ改行数の \n 列」に | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | # 置換して返す (行番号保存)。yatt コメントは宣言より強い構文要素なので、 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | # raw 本体の中でも widget 同様「取り除かれる」意味論を成立させる。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | # コメントが無ければ source_substr と同一 (バイト単位)。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 33 | ▶ | sub YATT::Lite::Core::Template::part_body_source { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
part_body_source: called CC=7 SCAR=19.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 33 | (my Template $tmpl, my Part $part) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 33 | my ($bodypos, $bodylen) = ($part->{bodypos}, $part->{bodylen}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 33 | my $src = $tmpl->source_substr($bodypos, $bodylen); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 33 | ▶ | return $src unless defined $src; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 33 | my $end = $bodypos + $bodylen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | # 後ろから置換すれば手前の offset がずれない | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 33 | ▶ | foreach my $entry (reverse @{$tmpl->{_boundarylist} // []}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$tmpl->{"_boundarylist"} // []
MC/DC0%0/1
$tmpl->{"_boundarylist"} // []
$tmpl->{"_boundarylist"}
Truth table50%1/2
A
A= $tmpl->{"_boundarylist"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 94 | ▶ | next unless $entry->{kind} eq 'comment'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 5 | ▶ | next unless $entry->{startpos} >= $bodypos and $entry->{endpos} <= $end; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$entry->{"startpos"} >= $bodypos and $entry->{"endpos"} <= $end
MC/DC50%1/2
$entry->{"startpos"} >= $bodypos and $entry->{"endpos"} <= $end
$entry->{"startpos"} >= $bodypos
$entry->{"endpos"} <= $end
Truth table66%2/3
A and B
A= $entry->{"startpos"} >= $bodyposB= $entry->{"endpos"} <= $end
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | substr($src, $entry->{startpos} - $bodypos | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | , $entry->{endpos} - $entry->{startpos}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 4 | = "\n" x $entry->{nlines}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 33 | $src; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 6 | ▶ | sub YATT::Lite::Core::Template::get_type_item { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_type_item: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 6 | (my Template $tmpl, my ($type, $name)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 6 | ▶ | my $class = $PART_KIND_CLASS{$type} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | or Carp::croak "Unknown type: $type"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 6 | $tmpl->{_Item}{$class->item_key_for($name)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 136 | ▶ | sub YATT::Lite::Core::Part::reorder_hash_params { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reorder_hash_params: called CC=7 SCAR=20.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 136 | (my Widget $widget, my ($orig_params)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 136 | ▶ | return unless $orig_params; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 17 | ▶ | return @$orig_params if ref $orig_params eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 3 | my $params = +{%$orig_params}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 3 | my @params; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 3 | ▶ | foreach my $name (map($_ ? @$_ : (), $widget->{_arg_order})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 4 | push @params, delete $params->{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | ▶ | if (my @unknown = grep {/^[a-z]\w*$/i} keys %$params) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | die "Unknown args for $widget->{name}: " . join(", ", @unknown) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 3 | ▶ | wantarray ? @params : \@params; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 77 | ▶ | sub reorder_cgi_params { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reorder_cgi_params: called CC=15 SCAR=27.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 392 | (my MY $self, my Widget $widget, my ($cgi, $list)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 392 | ▶ | $list ||= []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$list ||= []
MC/DC100%1/1
$list ||= []
$list
Truth table100%2/2
A
A= $list
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 392 | my $stash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 392 | ▶ | if ($self->{stash_unknown_params_to}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 386 | ▶ | $stash = $cgi->stash->{$self->{stash_unknown_params_to}} //= +{}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$cgi->stash->{$self->{"stash_unknown_params_to"}} //= {}
MC/DC0%0/1
$cgi->stash->{$self->{"stash_unknown_params_to"}} //= {}
$cgi->stash->{$self->{"stash_unknown_params_to"}}
Truth table50%1/2
A
A= $cgi->stash->{$self->{"stash_unknown_params_to"}}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 392 | foreach my $name ($cgi->param) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 165 | ▶ | next unless $name =~ /^[a-z]\w*$/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 118 | ▶ | my $argdecl = $widget->{_arg_dict}{$name} or do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 7 | ▶ | if ($stash) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 5 | push @{$stash->{$name}}, $cgi->multi_param($name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 5 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | my $wname = $widget->{name} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 2 | ▶ | ? " for widget '$widget->{name}'" : ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 2 | die "Unknown args$wname: $name\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 111 | ▶ | if ($argdecl->is_unsafe_param) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 7 | ▶ | if ($stash) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 6 | push @{$stash->{$name}}, $cgi->multi_param($name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 7 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 104 | my @value = $cgi->multi_param($name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 104 | my $type = $argdecl->type->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 104 | ▶ | if ($type eq 'list') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 2 | $list->[$argdecl->argno] = \@value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | } elsif ($type eq 'scalar') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | # scalar may receive nested query structures (?choice[foo]=1). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 2 | $list->[$argdecl->argno] = $value[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 100 | } elsif (grep {ref $_} @value) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | # text/bool never take a reference (?q[]=... would otherwise | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | # reach escape() as a structure). Treat like an unknown param. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 3 | ▶ | if ($stash) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 3 | push @{$stash->{$name}}, @value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 3 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 97 | $list->[$argdecl->argno] = $value[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 390 | @$list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 77 | ▶ | sub configure_rc_script { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
configure_rc_script: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 1 | (my MY $vfs, my $script) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 1 | my Folder $f = $vfs->{_root}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | my $pkg = $f->{entns} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 1 | ▶ | or die $vfs->error("package name is not specified for configure rc_script"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | # print STDERR "#### $pkg \n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | # XXX: base は設定済みだったはずだけど... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 1 | ckeval(qq{package $pkg; use strict; use YATT::Lite; $script}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | # Template alias さえ拡張すれば済むように。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | # 逆に言うと、 vfs_file だけを定義して Template を定義しなかった場合, 継承が働かなくなった。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 335 | ▶ | sub create_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_file: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 335 | (my MY $vfs, my $spec) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 335 | $vfs->Template->new(path => $spec, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | # called from <!yatt:base> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 77 | my %BASE_ATTS = ('' => 1, qw(file 1 dir 1)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 19 | ▶ | sub declare_base { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
declare_base: called CC=14 SCAR=28.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 19 | (my MY $vfs, my ParsingState $state, my Template $tmpl, my ($ns, @args)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 19 | ▶ | unless (@args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | $vfs->synerror($state, q{No base arg}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 19 | ▶ | my $base = $tmpl->{base} //= []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$tmpl->{"base"} //= []
MC/DC0%0/1
$tmpl->{"base"} //= []
$tmpl->{"base"}
Truth table50%1/2
A
A= $tmpl->{"base"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 19 | ▶ | if (@$base) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | $vfs->synerror($state, "Duplicate base decl! was=%s, new=%s" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | , terse_dump($base), terse_dump(\@args)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 19 | foreach my $att (@args) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 19 | my $type = $vfs->node_type($att); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 19 | ▶ | $type == TYPE_ATT_TEXT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | or $vfs->synerror($state, q{Not implemented base decl type: %s}, $att); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 19 | my $key = $vfs->node_path($att); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 19 | ▶ | unless ($BASE_ATTS{$key // ''}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$key // ""
MC/DC0%0/1
$key // ""
$key
Truth table50%1/2
A
A= $key
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 1 | ▶ | $vfs->synerror($state, q{Unknown base option: %s}, $key // '') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$key // ""
MC/DC0%0/1
$key // ""
$key
Truth table50%1/2
A
A= $key
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 18 | ▶ | nonempty(my $fn = $vfs->node_value($att)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | or $vfs->synerror($state, q{base spec is empty!}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 18 | ▶ | if ($vfs->{_on_memory}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 3 | ▶ | my $o = $vfs->find_file($fn) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | or $vfs->synerror($state, q{No such base path: %s}, $fn); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 3 | push @$base, $o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 15 | ▶ | defined(my $realfn = $vfs->resolve_path_from($tmpl, $fn)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | or $vfs->synerror($state, q{Can\'t find object path for: %s}, $fn); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 15 | ▶ | -e $realfn | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | or $vfs->synerror($state, q{No such base path: %s}, $realfn); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 15 | push @$base, my $o = $vfs->find_neighbor_type(undef, $realfn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 15 | $tmpl->add_dependency($realfn, $o); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | # GH-262: ここで find_product(perl => $o) してはいけない。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | # declare 段階は記述子を置くだけにする(base の decl parse は | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | # find_neighbor_type 経由の create 時に済んでいる)。product の生成は | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | # cgen 時の setup_inheritance_for → ensure_generated_for_folders と | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | # dispatch 時の find_part_handler の事前コンパイルが遅延実行する。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | # eager に生成すると、この宣言自身を parse 中のテンプレートが | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | # cached_in の dict 登録前(Util.pm:210)のため再 lookup で二重 create | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | # され、EntNS confliction になる(base+widget-use の循環参照が壊れる)。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 9 | ▶ | sub synerror { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
synerror: called CC=3 SCAR=11.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 9 | (my MY $vfs, my ParsingState $state, my ($fmt, @opts)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 9 | my $opts = {depth => 2}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 9 | ▶ | $opts->{tmpl_file} = $state->{path} if $state->{path}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 9 | ▶ | $opts->{tmpl_line} = $state->{_startln} if $state->{_startln}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 9 | die $vfs->error($opts, $fmt, @opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | # called from <!yatt:import> (LRXML::declare_import). GH-256 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 29 | ▶ | sub import_resolve_source { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
import_resolve_source: called CC=8 SCAR=21.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 29 | (my MY $vfs, my ParsingState $state, my Template $tmpl, my $fn) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 29 | my $o = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 29 | ▶ | if ($vfs->{_on_memory}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 11 | ▶ | $vfs->find_file($fn) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$vfs->find_file($fn) || $vfs->synerror($state, 'No such import path: %s', $fn)
MC/DC0%0/2
$vfs->find_file($fn) || $vfs->synerror($state, 'No such import path: %s', $fn)
$vfs->find_file($fn)
$vfs->synerror($state, 'No such import path: %s', $fn)
Truth table33%1/3
A || B
A= $vfs->find_file($fn)B= $vfs->synerror($state, 'No such import path: %s', $fn)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | or $vfs->synerror($state, q{No such import path: %s}, $fn); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 18 | ▶ | defined(my $realfn = $vfs->resolve_path_from($tmpl, $fn)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | or $vfs->synerror($state, qq{Can\'t find object path for import: %s}, $fn); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 18 | ▶ | -e $realfn | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | or $vfs->synerror($state, q{No such import path: %s}, $realfn); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | # find_neighbor_type より前に path で検査する。相手が cached_in の | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | # dict 代入前 (load 途中) だと、find_file が同じファイルの Template を | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | # 二重生成して EntNS confliction になってしまうため。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 18 | ▶ | if ($YATT::Lite::LRXML::DECL_PARSING{$realfn}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 1 | $vfs->synerror($state, q{Circular import detected: %s}, $fn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 17 | my $found = $vfs->find_neighbor_type(undef, $realfn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 16 | $tmpl->add_dependency($realfn, $found); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 16 | $found; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 27 | ▶ | unless (UNIVERSAL::isa($o, MY->Template)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | $vfs->synerror($state, q{import from non-template is not supported: %s}, $fn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 27 | my Template $src = $o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 27 | ▶ | if ($src->{_decl_parsing}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | $vfs->synerror($state, q{Circular import detected: %s}, $fn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | # import 対象は宣言時点でコンパイルしておく (cf. <!yatt:base> declare_base)。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | # これにより名前検証と @ISA/entns 確立が済んだ状態で以後の処理ができる。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 27 | $vfs->find_product(perl => $src); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 27 | $src; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | # ソース template から import 対象を探す。$kind が undef なら自動判定。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | # 戻り値: ($kind, $part_or_argmacro) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | # find_kind_part_from (VFS.pm) の kind 別実装。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | # item-key の符号化は各 part class の item_key_for に集約されている。GH-256 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 32 | ▶ | sub _find_kind_part__widget { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_find_kind_part__widget: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 32 | (my MY $vfs, my ($from, $name)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 32 | ▶ | my Part $part = $vfs->find_part_from($from, MY->Widget->item_key_for($name)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | # widget と page は同じ名前空間なので kind で照合する | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 21 | ▶ | ($part->{kind} // '') eq 'widget' ? $part : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$part->{"kind"} // ""
MC/DC0%0/1
$part->{"kind"} // ""
$part->{"kind"}
Truth table50%1/2
A
A= $part->{"kind"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 31 | ▶ | sub _find_kind_part__page { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_find_kind_part__page: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 31 | (my MY $vfs, my ($from, $name)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 31 | ▶ | my Part $part = $vfs->find_part_from($from, MY->Page->item_key_for($name)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 20 | ▶ | ($part->{kind} // '') eq 'page' ? $part : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$part->{"kind"} // ""
MC/DC0%0/1
$part->{"kind"} // ""
$part->{"kind"}
Truth table50%1/2
A
A= $part->{"kind"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 30 | ▶ | sub _find_kind_part__action { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_find_kind_part__action: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 30 | (my MY $vfs, my ($from, $name)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 30 | $vfs->find_part_from($from, MY->Action->item_key_for($name)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 30 | ▶ | sub _find_kind_part__entity { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_find_kind_part__entity: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 30 | (my MY $vfs, my ($from, $name)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 30 | $vfs->find_part_from($from, MY->Entity->item_key_for($name)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 30 | ▶ | sub _find_kind_part__argmacro { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_find_kind_part__argmacro: called CC=7 SCAR=22.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 30 | (my MY $vfs, my ($from, $name)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 30 | my Folder $folder = $from; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 30 | ▶ | my $macro = $folder->{_argmacro_dict} && $folder->{_argmacro_dict}{$name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$folder->{'_argmacro_dict'} && $folder->{'_argmacro_dict'}{$name}
MC/DC100%2/2
$folder->{'_argmacro_dict'} && $folder->{'_argmacro_dict'}{$name}
$folder->{'_argmacro_dict'}
$folder->{'_argmacro_dict'}{$name}
Truth table100%3/3
A && B
A= $folder->{'_argmacro_dict'}B= $folder->{'_argmacro_dict'}{$name}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 30 | ▶ | return $macro if $macro; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | # find_argmacro (LRXML.pm) と同じく base 1 段のみ探索 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 26 | foreach my Folder $base ($folder->list_base) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 26 | ▶ | next unless UNIVERSAL::isa($base, MY->Template); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 0 | my Template $baseTmpl = $base; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | return $baseTmpl->{_argmacro_dict}{$name} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 0 | ▶ | if $baseTmpl->{_argmacro_dict} && $baseTmpl->{_argmacro_dict}{$name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$baseTmpl->{"_argmacro_dict"} and $baseTmpl->{"_argmacro_dict"}{$name}
MC/DC0%0/2
$baseTmpl->{"_argmacro_dict"} and $baseTmpl->{"_argmacro_dict"}{$name}
$baseTmpl->{"_argmacro_dict"}
$baseTmpl->{"_argmacro_dict"}{$name}
Truth table0%0/3
A and B
A= $baseTmpl->{"_argmacro_dict"}B= $baseTmpl->{"_argmacro_dict"}{$name}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | # find_argmacro と同じく、最後に Site 設定 (argmacro => ...) の primary ns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 26 | $vfs->find_argmacro_module(undef, undef, $name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | # argmacro の登録エラーは parse 時を待たず、構築時に報告する | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 242 | ▶ | sub after_new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
after_new: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 242 | (my MY $vfs) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 242 | $vfs->SUPER::after_new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 242 | ▶ | $vfs->argmacro_registry if $vfs->{argmacro}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | # LRXML の既定 namespace と同じ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 46 | ▶ | sub argmacro_namespace_list { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
argmacro_namespace_list: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 46 | (my MY $vfs) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 46 | my @nslist = lexpand($vfs->{namespace}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 46 | ▶ | @nslist ? @nslist : qw(yatt perl); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | # Site 設定 argmacro を {$ns}{$name} => 'Module' に正規化して返す。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | # argmacro => {name => 'Module', ...} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | # argmacro => [[ns => {name => 'Module', ...}], {name => 'Module'}, ...] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | # 名前空間無しの登録は primary ns (namespace の先頭) での登録と同義。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | # (ns, name) の重複、namespace に無い ns、形式不正は登録エラー。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 55 | ▶ | sub argmacro_registry { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
argmacro_registry: called CC=16 SCAR=28.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 55 | (my MY $vfs) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 55 | ▶ | $vfs->{_argmacro_registry} //= do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$vfs->{"_argmacro_registry"} //= do {
my(@nslist) = $vfs->argmacro_namespace_list;
my %known;
$known{$_} = 1 foreach (@nslist);
my $die = sub {
my($fmt, @args) = @_;
die $vfs->error({"depth", 3}, $fmt, @args);
}
;
my %registry;
my $spec = $vfs->{"argmacro"};
foreach my $item (ref $spec eq "ARRAY" ? @$spec : $spec // ()) {
() = ref $item eq "ARRAY" ? @$item : (undef, $item);
if (ref $item eq "ARRAY" and @$item != 2 or ref $dict ne "HASH") {
&$die("Invalid argmacro registration: %s", terse_dump($item));
};
if (defined $ns and not $known{$ns}) {
&$die("Unknown namespace '%s' in argmacro registration", $ns);
};
$ns //= $nslist[0];
foreach my $name (sort keys %$dict) {
$name =~ /^\w+\z/ or &$die("Invalid argmacro name '%s'", $name);
$registry{$ns}{$name} and &$die("Duplicate argmacro registration '%s:%s'", $ns, $name);
$registry{$ns}{$name} = $dict->{$name};
};
};
\%registry
}
MC/DC0%0/2
$vfs->{"_argmacro_registry"} //= do {
my(@nslist) = $vfs->argmacro_namespace_list;
my %known;
$known{$_} = 1 foreach (@nslist);
my $die = sub {
my($fmt, @args) = @_;
die $vfs->error({"depth", 3}, $fmt, @args);
}
;
my %registry;
my $spec = $vfs->{"argmacro"};
foreach my $item (ref $spec eq "ARRAY" ? @$spec : $spec // ()) {
() = ref $item eq "ARRAY" ? @$item : (undef, $item);
if (ref $item eq "ARRAY" and @$item != 2 or ref $dict ne "HASH") {
&$die("Invalid argmacro registration: %s", terse_dump($item));
};
if (defined $ns and not $known{$ns}) {
&$die("Unknown namespace '%s' in argmacro registration", $ns);
};
$ns //= $nslist[0];
foreach my $name (sort keys %$dict) {
$name =~ /^\w+\z/ or &$die("Invalid argmacro name '%s'", $name);
$registry{$ns}{$name} and &$die("Duplicate argmacro registration '%s:%s'", $ns, $name);
$registry{$ns}{$name} = $dict->{$name};
};
};
\%registry
}
$vfs->{"_argmacro_registry"}
do {
my(@nslist) = $vfs->argmacro_namespace_list;
my %known;
$known{$_} = 1 foreach (@nslist);
my $die = sub {
my($fmt, @args) = @_;
die $vfs->error({"depth", 3}, $fmt, @args);
}
;
my %registry;
my $spec = $vfs->{"argmacro"};
foreach my $item (ref $spec eq "ARRAY" ? @$spec : $spec // ()) {
() = ref $item eq "ARRAY" ? @$item : (undef, $item);
if (ref $item eq "ARRAY" and @$item != 2 or ref $dict ne "HASH") {
&$die("Invalid argmacro registration: %s", terse_dump($item));
};
if (defined $ns and not $known{$ns}) {
&$die("Unknown namespace '%s' in argmacro registration", $ns);
};
$ns //= $nslist[0];
foreach my $name (sort keys %$dict) {
$name =~ /^\w+\z/ or &$die("Invalid argmacro name '%s'", $name);
$registry{$ns}{$name} and &$die("Duplicate argmacro registration '%s:%s'", $ns, $name);
$registry{$ns}{$name} = $dict->{$name};
};
};
\%registry
}
Truth table66%2/3
A //= B
A= $vfs->{"_argmacro_registry"}B= do {
my(@nslist) = $vfs->argmacro_namespace_list;
my %known;
$known{$_} = 1 foreach (@nslist);
my $die = sub {
my($fmt, @args) = @_;
die $vfs->error({"depth", 3}, $fmt, @args);
}
;
my %registry;
my $spec = $vfs->{"argmacro"};
foreach my $item (ref $spec eq "ARRAY" ? @$spec : $spec // ()) {
() = ref $item eq "ARRAY" ? @$item : (undef, $item);
if (ref $item eq "ARRAY" and @$item != 2 or ref $dict ne "HASH") {
&$die("Invalid argmacro registration: %s", terse_dump($item));
};
if (defined $ns and not $known{$ns}) {
&$die("Unknown namespace '%s' in argmacro registration", $ns);
};
$ns //= $nslist[0];
foreach my $name (sort keys %$dict) {
$name =~ /^\w+\z/ or &$die("Invalid argmacro name '%s'", $name);
$registry{$ns}{$name} and &$die("Duplicate argmacro registration '%s:%s'", $ns, $name);
$registry{$ns}{$name} = $dict->{$name};
};
};
\%registry
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 18 | my @nslist = $vfs->argmacro_namespace_list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 18 | my %known; $known{$_} = 1 for @nslist; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 5 | ▶ | my $die = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 5 | my ($fmt, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 5 | die $vfs->error({depth => 3}, $fmt, @args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 18 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 18 | my %registry; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 18 | my $spec = $vfs->{argmacro}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 18 | ▶ | foreach my $item (ref $spec eq 'ARRAY' ? @$spec : ($spec // ())) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$spec // ()
MC/DC0%0/2
$spec // ()
$spec
()
Truth table33%1/3
A // B
A= $specB= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 21 | ▶ | my ($ns, $dict) = ref $item eq 'ARRAY' ? @$item | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | : (undef, $item); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 21 | ▶ | if (ref $item eq 'ARRAY' and @$item != 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
ref $item eq "ARRAY" and @$item != 2 or ref $dict ne "HASH"
ref $item eq "ARRAY" and @$item != 2
MC/DC33%1/3
ref $item eq "ARRAY" and @$item != 2 or ref $dict ne "HASH"
ref $item eq "ARRAY"
@$item != 2
ref $dict ne "HASH"
Truth table60%3/5
A and B or C
A= ref $item eq "ARRAY"B= @$item != 2C= ref $dict ne "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | or ref $dict ne 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 1 | $die->(q{Invalid argmacro registration: %s} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | , terse_dump($item)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 20 | ▶ | if (defined $ns and not $known{$ns}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $ns and not $known{$ns}
MC/DC100%2/2
defined $ns and not $known{$ns}
defined $ns
not $known{$ns}
Truth table100%3/3
A and not(B)
A= defined $nsB= not $known{$ns}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 1 | $die->(q{Unknown namespace '%s' in argmacro registration}, $ns); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 19 | ▶ | $ns //= $nslist[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$ns //= $nslist[0]
MC/DC0%0/2
$ns //= $nslist[0]
$ns
$nslist[0]
Truth table66%2/3
A //= B
A= $nsB= $nslist[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 19 | foreach my $name (sort keys %$dict) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 22 | ▶ | $name =~ /^\w+\z/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | or $die->(q{Invalid argmacro name '%s'}, $name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 21 | ▶ | $registry{$ns}{$name} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | and $die->(q{Duplicate argmacro registration '%s:%s'}, $ns, $name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 19 | $registry{$ns}{$name} = $dict->{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 13 | \%registry; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | # Site 設定 argmacro で ($ns, $name) に登録された ArgMacro を返す。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | # $ns が undef なら primary ns。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | # Module は YATT::Lite::ArgMacro を use して定義する(1 pm = 1 macro)。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | # Core::ArgMacro は VFS 単位で一度だけ作り、ここで strong に保持する。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 63 | ▶ | sub find_argmacro_module { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_argmacro_module: called CC=6 SCAR=18.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 63 | (my MY $vfs, my ParsingState $state, my ($ns, $name)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 63 | ▶ | return undef unless $vfs->{argmacro}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 37 | ▶ | $ns //= ($vfs->argmacro_namespace_list)[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$ns //= ($vfs->argmacro_namespace_list)[0]
MC/DC0%0/2
$ns //= ($vfs->argmacro_namespace_list)[0]
$ns
($vfs->argmacro_namespace_list)[0]
Truth table66%2/3
A //= B
A= $nsB= ($vfs->argmacro_namespace_list)[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 37 | ▶ | my $pkg = $vfs->argmacro_registry->{$ns}{$name} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 31 | ▶ | $vfs->{_argmacro_module_cache}{"$ns:$name"} //= do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$vfs->{"_argmacro_module_cache"}{"${ns}:$name"} //= do {
my $die = sub {
my($fmt, @args) = @_;
$state ? $vfs->synerror($state, $fmt, @args) : die($vfs->error({"depth", 2}, $fmt, @args));
}
;
YATT::Lite::Util::ckrequire($pkg);
unless (UNIVERSAL::isa($pkg, "YATT::Lite::ArgMacro")) {
&$die("argmacro module '%s' for '%s' is not a YATT::Lite::ArgMacro", $pkg, $name);
};
$pkg->as_argmacro_part($vfs->get_parser, $name, $ns)
}
MC/DC0%0/2
$vfs->{"_argmacro_module_cache"}{"${ns}:$name"} //= do {
my $die = sub {
my($fmt, @args) = @_;
$state ? $vfs->synerror($state, $fmt, @args) : die($vfs->error({"depth", 2}, $fmt, @args));
}
;
YATT::Lite::Util::ckrequire($pkg);
unless (UNIVERSAL::isa($pkg, "YATT::Lite::ArgMacro")) {
&$die("argmacro module '%s' for '%s' is not a YATT::Lite::ArgMacro", $pkg, $name);
};
$pkg->as_argmacro_part($vfs->get_parser, $name, $ns)
}
$vfs->{"_argmacro_module_cache"}{"${ns}:$name"}
do {
my $die = sub {
my($fmt, @args) = @_;
$state ? $vfs->synerror($state, $fmt, @args) : die($vfs->error({"depth", 2}, $fmt, @args));
}
;
YATT::Lite::Util::ckrequire($pkg);
unless (UNIVERSAL::isa($pkg, "YATT::Lite::ArgMacro")) {
&$die("argmacro module '%s' for '%s' is not a YATT::Lite::ArgMacro", $pkg, $name);
};
$pkg->as_argmacro_part($vfs->get_parser, $name, $ns)
}
Truth table66%2/3
A //= B
A= $vfs->{"_argmacro_module_cache"}{"${ns}:$name"}B= do {
my $die = sub {
my($fmt, @args) = @_;
$state ? $vfs->synerror($state, $fmt, @args) : die($vfs->error({"depth", 2}, $fmt, @args));
}
;
YATT::Lite::Util::ckrequire($pkg);
unless (UNIVERSAL::isa($pkg, "YATT::Lite::ArgMacro")) {
&$die("argmacro module '%s' for '%s' is not a YATT::Lite::ArgMacro", $pkg, $name);
};
$pkg->as_argmacro_part($vfs->get_parser, $name, $ns)
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 1 | ▶ | my $die = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 1 | my ($fmt, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 1 | ▶ | $state ? $vfs->synerror($state, $fmt, @args) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | : die $vfs->error({depth => 2}, $fmt, @args); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 16 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 16 | YATT::Lite::Util::ckrequire($pkg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 16 | ▶ | unless (UNIVERSAL::isa($pkg, 'YATT::Lite::ArgMacro')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 1 | $die->(q{argmacro module '%s' for '%s' is not a YATT::Lite::ArgMacro} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | , $pkg, $name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 15 | $pkg->as_argmacro_part($vfs->get_parser, $name, $ns); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 29 | ▶ | sub import_find_source_part { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
import_find_source_part: called CC=10 SCAR=23.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 29 | (my MY $vfs, my ParsingState $state, my Template $src, my ($srcName, $kind)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 29 | ▶ | my $srcDesc = $src->{path} // $src->{name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$src->{"path"} // $src->{"name"}
MC/DC0%0/2
$src->{"path"} // $src->{"name"}
$src->{"path"}
$src->{"name"}
Truth table66%2/3
A // B
A= $src->{"path"}B= $src->{"name"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | # 全 kind を probe する (widget/page は同じ名前空間だが kind 照合で区別される) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 29 | my @hits; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 29 | foreach my $k (qw(widget page action entity argmacro)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 145 | ▶ | if (defined (my $found = $vfs->find_kind_part_from($src, $k, $srcName))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 29 | push @hits, [$k => $found]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 29 | ▶ | if (defined $kind) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 10 | foreach my $hit (@hits) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 10 | ▶ | return @$hit if $hit->[0] eq $kind; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 2 | ▶ | if (@hits) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | $vfs->synerror($state | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | , q{Import kind mismatch for '%s': expected %s, but %s has %s} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | , $srcName, $kind, $srcDesc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 2 | , join(", ", map {$_->[0]} @hits)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 0 | $vfs->synerror($state, q{No such part to import: %s:%s (in %s)} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | , $srcName, $kind, $srcDesc); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 19 | ▶ | unless (@hits) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 2 | $vfs->synerror($state, q{No such part to import: %s (in %s)} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | , $srcName, $srcDesc); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 17 | ▶ | if (@hits > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | $vfs->synerror($state | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | , q{Ambiguous import '%s' in %s (found as: %s); add kind annotation like [%s:%s]} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 2 | , $srcName, $srcDesc, join(", ", map {$_->[0]} @hits) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | , $srcName, $hits[0][0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 15 | return @{$hits[0]}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 1263 | ▶ | sub Parser { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Parser: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | # local $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | # my $err = catch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 1263 | require YATT::Lite::LRXML; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | # }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | # unless ($err =~ /^Can't locate loadable object for module main::Tie::Hash::NamedCapture/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | # die $err || $@ || "(unknown reason)"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 1263 | 'YATT::Lite::LRXML' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 0 | ▶ | sub cgen_perl { 'YATT::Lite::CGen::Perl' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cgen_perl: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 857 | ▶ | sub stat_mtime { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stat_mtime: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 857 | my ($fn) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 857 | ▶ | -e $fn or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 857 | (stat($fn))[9]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 1263 | ▶ | sub get_parser { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_parser: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 1263 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | # $self->{parser} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | $self->Parser->new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | (vfs => $self, $self->cf_delegate | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | (qw(namespace special_entities | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | match_argsroute_first | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | body_argument | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | body_argument_type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | allow_bare_entity_in_decl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | , [debug_parser => 'debug'] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | , [tmpl_encoding => 'encoding'] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 1263 | ▶ | , $self->{parse_while_loading} ? (all => 1) : () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | , @_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | 60 | ▶ | sub ensure_parsed { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ensure_parsed: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | 60 | (my MY $self, my Part $part) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 60 | my $parser = $self->get_parser; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | 60 | my Template $tmpl = $part->{folder}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 60 | ▶ | return if $tmpl->{_parse_ok}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 4 | $parser->parse_decllist_entities($tmpl); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 4 | $parser->parse_body($tmpl); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 0 | ▶ | sub render { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
render: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 0 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | 0 | ▶ | open my $fh, '>', \ (my $str = "") or die "Can't open capture buffer!: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 0 | $self->render_into($fh, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 0 | close $fh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 0 | $str; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | 1 | ▶ | sub render_into { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
render_into: called CC=5 SCAR=18.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 1 | (my MY $self, my ($fh, $namerec, $args, @opts)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 1 | my ($part, $sub, $pkg) = $self->find_part_handler($namerec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | 1 | ▶ | unless ($part->public) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | # XXX: refresh する手もあるだろう。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | 0 | croak $self->error(q|Forbidden request '%s'|, terse_dump($namerec)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 1 | my @args = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 1 | ▶ | if (not defined $args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | 0 | (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | } elsif (ref $args eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 0 | @$args | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | # $args can be a Hash::MultiValue and other HASH compatible obj. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 1 | $part->reorder_hash_params($args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | 1 | ▶ | if (@opts) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 0 | $self->cf_let(\@opts, $sub, $pkg, $fh, @args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 1 | $sub->($pkg, $fh, @args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | # root から見える part (と、その template)を取り出す。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 0 | ▶ | sub get_part { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_part: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 0 | (my MY $self, my $name, my %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | 0 | my $ignore_error = delete $opts{ignore_error}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 0 | my Template $tmpl; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | my Part $part; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 0 | ▶ | if (UNIVERSAL::isa($self->{_root}, Template)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | 0 | $tmpl = $self->{_root}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 0 | $part = $self->find_part($name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 0 | ▶ | $tmpl = $self->find_file($name) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
$tmpl = $self->find_file($name) or $ignore_error and return
$ignore_error and return
MC/DC0%0/2
$tmpl = $self->find_file($name) or $ignore_error and return
$tmpl = $self->find_file($name)
$ignore_error
Truth table0%0/3
A or B
A= $tmpl = $self->find_file($name)B= $ignore_error
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | or ($ignore_error and return) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | or croak "No such template file: $name"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | 0 | $part = $tmpl->{_Item}{''}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | # XXX: それとも、 $part から $tmpl が引けるようにするか? weaken して... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | 0 | ▶ | wantarray ? ($part, $tmpl) : $part; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 144 | ▶ | sub find_part_renderer { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_part_renderer: called CC=12 SCAR=32.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 144 | (my MY $self, my ($widgetPath, %opts)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 144 | my $ignore_error = delete $opts{ignore_error}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 144 | ▶ | my @wpath = ref $widgetPath ? @$widgetPath : split ":", $widgetPath; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 144 | ▶ | my $part = $self->find_part_from($self->{_root}, @wpath ? @wpath : '') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition20%1/5
my $part = $self->find_part_from($self->{"_root"}, @wpath ? @wpath : "") or $ignore_error and return
$ignore_error and return
MC/DC0%0/2
my $part = $self->find_part_from($self->{"_root"}, @wpath ? @wpath : "") or $ignore_error and return
my $part = $self->find_part_from($self->{"_root"}, @wpath ? @wpath : "")
$ignore_error
Truth table33%1/3
A or B
A= my $part = $self->find_part_from($self->{"_root"}, @wpath ? @wpath : "")B= $ignore_error
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | or ($ignore_error and return) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | or croak "No such widget: ".join(":", @wpath); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | 136 | my $tmpl = $part->cget('folder'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 136 | my $path = $tmpl->cget('path'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 136 | my $method = "render_".$part->cget('name'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 136 | ▶ | my $pkg = $self->find_product(perl => $tmpl) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
my $pkg = $self->find_product("perl", $tmpl) or $ignore_error and return
$ignore_error and return
MC/DC0%0/2
my $pkg = $self->find_product("perl", $tmpl) or $ignore_error and return
my $pkg = $self->find_product("perl", $tmpl)
$ignore_error
Truth table33%1/3
A or B
A= my $pkg = $self->find_product("perl", $tmpl)B= $ignore_error
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | or ($ignore_error and return) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | or croak "Can't compile template file: $path"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 135 | ▶ | my $sub = $pkg->can($method) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
my $sub = $pkg->can($method) or $ignore_error and return
$ignore_error and return
MC/DC0%0/2
my $sub = $pkg->can($method) or $ignore_error and return
my $sub = $pkg->can($method)
$ignore_error
Truth table33%1/3
A or B
A= my $sub = $pkg->can($method)B= $ignore_error
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | or ($ignore_error and return) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | or croak "Can't extract $method from file: $path"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 135 | ($part, $sub, $pkg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | 505 | ▶ | sub find_part_handler { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_part_handler: called CC=24 SCAR=34.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 505 | (my MY $self, my $nameSpec, my %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 505 | my $ignore_error = delete $opts{ignore_error}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | 505 | ▶ | my ($partName, $kind, $pureName, @rest) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | = ref $nameSpec ? @$nameSpec : $nameSpec; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 505 | ▶ | $partName ||= $self->{index_name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$partName ||= $self->{"index_name"}
MC/DC50%1/2
$partName ||= $self->{"index_name"}
$partName
$self->{"index_name"}
Truth table66%2/3
A ||= B
A= $partNameB= $self->{"index_name"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | 505 | my Template $tmpl = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 505 | ▶ | if (UNIVERSAL::isa($self->{_root}, Template)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | # Special case. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | # XXX: Should add action tests for this case. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 1 | $self->{_root}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | # General container case. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | 504 | ▶ | $self->find_file($partName) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition71%5/7
$self->find_file($partName) || $ignore_error && (return) || croak("No such template file: $partName")
$self->find_file($partName) or $ignore_error and return
$ignore_error and return
MC/DC0%0/2
$self->find_file($partName) || $ignore_error && (return) || croak("No such template file: $partName")
$self->find_file($partName)
$ignore_error
Truth table33%1/3
A or B
A= $self->find_file($partName)B= $ignore_error
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | or ($ignore_error and return) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | or croak "No such template file: $partName"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | # part 探索より先にコンパイルする。継承 part の探索 (lookup_base) は | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | # @ISA に依存し、@ISA は setup_inheritance_for (コード生成時) が張るため。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | # GH-255 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | 325 | ▶ | my $pkg = $self->find_product(perl => $tmpl) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
my $pkg = $self->find_product("perl", $tmpl) or $ignore_error and return
$ignore_error and return
MC/DC0%0/2
my $pkg = $self->find_product("perl", $tmpl) or $ignore_error and return
my $pkg = $self->find_product("perl", $tmpl)
$ignore_error
Truth table33%1/3
A or B
A= my $pkg = $self->find_product("perl", $tmpl)B= $ignore_error
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | or ($ignore_error and return) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | or croak "Can't compile template file: $partName"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | 325 | (my Part $part, my $method) = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | 325 | (my Part $p, my $meth); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | 325 | ▶ | if (not defined $kind and not defined $pureName) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $kind or defined $pureName
MC/DC50%1/2
defined $kind or defined $pureName
defined $kind
defined $pureName
Truth table66%2/3
A or B
A= defined $kindB= defined $pureName
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | 273 | foreach my $k (qw(page action)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | 277 | (my $itemKey, $meth) = $self->can("_itemKey_$k")->($self, ''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | 277 | ▶ | $p = $tmpl->{_Item}{$itemKey} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | and last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 325 | ▶ | if ($p) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | 273 | ($p, $meth); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | 52 | ▶ | $kind //= 'page'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$kind //= "page"
MC/DC0%0/1
$kind //= "page"
$kind
Truth table50%1/2
A
A= $kind
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | 52 | ▶ | $pureName //= ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$pureName //= ""
MC/DC0%0/1
$pureName //= ""
$pureName
Truth table50%1/2
A
A= $pureName
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 52 | my ($itemKey, $meth) = $self->can("_itemKey_$kind")->($self, $pureName); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | 52 | ▶ | $p = $tmpl->{_Item}{$itemKey} || $self->find_part_from($tmpl, $itemKey) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition75%6/8
$p = $tmpl->{"_Item"}{$itemKey} || $self->find_part_from($tmpl, $itemKey) or $ignore_error and return
$tmpl->{'_Item'}{$itemKey} || $self->find_part_from($tmpl, $itemKey)
$ignore_error and return
MC/DC66%2/3
$p = $tmpl->{"_Item"}{$itemKey} || $self->find_part_from($tmpl, $itemKey) or $ignore_error and return
$tmpl->{'_Item'}{$itemKey}
$self->find_part_from($tmpl, $itemKey)
$ignore_error
Truth table75%3/4
A || B or C
A= $tmpl->{'_Item'}{$itemKey}B= $self->find_part_from($tmpl, $itemKey)C= $ignore_error
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | or ($ignore_error and return) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | or croak "No such $kind in file $partName: $pureName"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 50 | ($p, $meth); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | # import alias はソース Part へ解決してから返す | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | # (public 判定や引数 reorder が常に最新のソース側メタで動くように)。GH-256 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 323 | $part = $part->resolve_alias($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | 323 | ▶ | my $sub = $pkg->can($method) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
my $sub = $pkg->can($method) or $ignore_error and return
$ignore_error and return
MC/DC0%0/2
my $sub = $pkg->can($method) or $ignore_error and return
my $sub = $pkg->can($method)
$ignore_error
Truth table33%1/3
A or B
A= my $sub = $pkg->can($method)B= $ignore_error
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | or ($ignore_error and return) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | or croak "Can't extract $method from file: $partName"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 323 | ($part, $sub, $pkg, @rest); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 315 | ▶ | sub _itemKey_page { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_itemKey_page: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | 315 | shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 315 | (MY->Page->item_key_for($_[0]), MY->Page->method_name_for($_[0])); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 14 | ▶ | sub _itemKey_action { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_itemKey_action: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 14 | shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | 14 | (MY->Action->item_key_for($_[0]), MY->Action->method_name_for($_[0])); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | # Action name => sub {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | 1 | ▶ | sub add_root_action_handler { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_root_action_handler: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | 1 | (my MY $self, my ($name, $sub, $callinfo)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 1 | my Folder $root = $self->{_root}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 1 | my ($callpack, $filename, $lineno) = @$callinfo; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | # XXX: This means do_$A.yatt will conflict with "Action $A" in .htyattrc.pl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | 1 | my $action_name = "do_$name"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | 1 | *{globref($root->{entns}, $action_name)} = $sub; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | 1 | $root->{_Item}{MY->Action->item_key_for($name)} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | = $self->Action->new(name => $action_name, kind => 'action' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | , folder => $root | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | , startln => $lineno | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | 192 | ▶ | sub find_renderer { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_renderer: called CC=3 SCAR=11.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | 192 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | 192 | ▶ | my ($part, $sub, $pkg) = $self->find_part_handler(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | 17 | ▶ | wantarray ? ($sub, $pkg) : $sub; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | # DirHandler INST 固有 CGEN_perl の生成 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | 564 | ▶ | sub get_cgen_class { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_cgen_class: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | 564 | (my MY $self, my $type) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | 564 | $self->{facade}->get_cgen_class($type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | # XXX: Action only コンパイルは? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | 988 | ▶ | sub find_product { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_product: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | 988 | (my MY $self, my $spec, my Template $tmpl, my %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | 988 | ▶ | my ($type, $kind) = ref $spec ? @$spec : $spec; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | # local $YATT = $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | 988 | ▶ | unless ($tmpl->{_product}{$type}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | 547 | my $cgen = $self->build_cgen_of($type, \%opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | # 二重生成防止のため、代入自体は ensure_generated の中で行う。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 547 | $cgen->ensure_generated($spec => $tmpl); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | 911 | $tmpl->{_product}{$type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | 564 | ▶ | sub build_cgen_of { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_cgen_of: called CC=3 SCAR=16.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | 564 | (my MY $self, my $cgenSpec, my $opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | 564 | my ($type, $cg_class) = lexpand($cgenSpec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 564 | ▶ | $cg_class //= $self->get_cgen_class($type); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$cg_class //= $self->get_cgen_class($type)
MC/DC0%0/2
$cg_class //= $self->get_cgen_class($type)
$cg_class
$self->get_cgen_class($type)
Truth table33%1/3
A //= B
A= $cg_classB= $self->get_cgen_class($type)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | $cg_class->new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | (vfs => $self | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | , $self->cf_delegate(qw(no_lineinfo check_lineno only_parse | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | prefer_call_for_entity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | no_conditional_call | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | lcmsg_sink | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | pagevars | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | )) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | , parser => $self->get_parser | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | 497 | ▶ | , sink => $opts->{sink} || sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=27.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | 497 | my ($info, @script) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | 497 | ▶ | if ($self->{debug_cgen}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | 0 | my Template $real = $info->{folder}; # XXX: type??? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | 0 | ▶ | print STDERR "# compiling @{[$type//'undef']} code of @{[$real->{path}//'undef']}\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$type // "undef"
$real->{"path"} // "undef"
MC/DC0%0/1
$type // "undef"
$type
MC/DC0%0/1
$real->{"path"} // "undef"
$real->{"path"}
Truth table0%0/2
A
A= $type
Truth table0%0/2
A
A= $real->{"path"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | 0 | ▶ | if ($self->{debug_cgen} >= 2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | 0 | print STDERR "#--BEGIN--\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | 0 | print STDERR @script, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | 0 | print STDERR "#--END--\n\n" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | 497 | $self->{_n_compiles}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | 497 | ckeval(@script); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | 564 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$opts->{'sink'} || sub {
my($info, @script) = @_;
if ($self->{'debug_cgen'}) {
my YATT::Lite::Core::Template $real = $info->{'folder'};
print STDERR "# compiling @{[$type // 'undef'];} code of @{[$real->{'path'} // 'undef'];}\n";
if ($self->{'debug_cgen'} >= 2) {
print STDERR "#--BEGIN--\n";
print STDERR @script, "\n";
print STDERR "#--END--\n\n";
};
};
++$self->{'_n_compiles'};
ckeval(@script);
}
MC/DC0%0/2
$opts->{'sink'} || sub {
my($info, @script) = @_;
if ($self->{'debug_cgen'}) {
my YATT::Lite::Core::Template $real = $info->{'folder'};
print STDERR "# compiling @{[$type // 'undef'];} code of @{[$real->{'path'} // 'undef'];}\n";
if ($self->{'debug_cgen'} >= 2) {
print STDERR "#--BEGIN--\n";
print STDERR @script, "\n";
print STDERR "#--END--\n\n";
};
};
++$self->{'_n_compiles'};
ckeval(@script);
}
$opts->{'sink'}
sub {
my($info, @script) = @_;
if ($self->{'debug_cgen'}) {
my YATT::Lite::Core::Template $real = $info->{'folder'};
print STDERR "# compiling @{[$type // 'undef'];} code of @{[$real->{'path'} // 'undef'];}\n";
if ($self->{'debug_cgen'} >= 2) {
print STDERR "#--BEGIN--\n";
print STDERR @script, "\n";
print STDERR "#--END--\n\n";
};
};
++$self->{'_n_compiles'};
ckeval(@script);
}
Truth table66%2/3
A || B
A= $opts->{'sink'}B= sub {
my($info, @script) = @_;
if ($self->{'debug_cgen'}) {
my YATT::Lite::Core::Template $real = $info->{'folder'};
print STDERR "# compiling @{[$type // 'undef'];} code of @{[$real->{'path'} // 'undef'];}\n";
if ($self->{'debug_cgen'} >= 2) {
print STDERR "#--BEGIN--\n";
print STDERR @script, "\n";
print STDERR "#--END--\n\n";
};
};
++$self->{'_n_compiles'};
ckeval(@script);
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | # extract_lcmsg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | # - filelist is a list(or scalar) of filename or item name(no ext). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | # - msgdict is used to share same msgid. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | # - msglist is used to keep msg order. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | # XXX: find_product and extract_lcmsg is exclusive. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | 3 | ▶ | sub extract_lcmsg { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
extract_lcmsg: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | 3 | (my MY $self, my ($filelist, $msglist, $msgdict)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | 3 | require Locale::PO; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 3 | ▶ | $msglist //= []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$msglist //= []
MC/DC100%1/1
$msglist //= []
$msglist
Truth table100%2/2
A
A= $msglist
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | 3 | ▶ | $msgdict //= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$msgdict //= {}
MC/DC0%0/1
$msgdict //= {}
$msgdict
Truth table50%1/2
A
A= $msgdict
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | 4 | ▶ | local $self->{lcmsg_sink} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | 4 | $self->define_lcmsg_in($msglist, $msgdict, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | 3 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | 3 | my $type = 'perl'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | 3 | foreach my $name (lexpand($filelist)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | 3 | ▶ | my Template $tmpl = $self->find_file($name) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | or croak "No such template: $name"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | 3 | $self->find_product($type => $tmpl); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | # XXX: not wantarray | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | 3 | @$msglist; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | 4 | ▶ | sub define_lcmsg_in { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
define_lcmsg_in: called CC=4 SCAR=14.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | 4 | (my MY $self, my ($list, $dict, $place, $msgid, $other_msgs, $args)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | 4 | ▶ | if (my $obj = $dict->{$msgid}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | 0 | $obj->reference(join " ", grep {defined $_} $obj->reference, $place); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | 4 | my @o = (-msgid => $msgid); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | 4 | ▶ | if ($other_msgs and $other_msgs->[0]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$other_msgs and $other_msgs->[0]
MC/DC50%1/2
$other_msgs and $other_msgs->[0]
$other_msgs
$other_msgs->[0]
Truth table66%2/3
A and B
A= $other_msgsB= $other_msgs->[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | 1 | push @o, -msgid_plural => $other_msgs->[0] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | , -msgstr_n => {0 => '', 1 => ''}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | 3 | push @o, -msgstr => ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | 4 | push @$list, my $po = $dict->{$msgid} = Locale::PO->new(@o); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | 4 | $po->add_flag('perl-format'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | 4 | $po->reference($place); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | 608 | ▶ | sub YATT::Lite::Core::Template::after_create { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
after_create: called CC=4 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | 608 | (my Template $tmpl, my MY $self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | # XXX: ここでは SUPER が使えない。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | 608 | $tmpl->YATT::Lite::VFS::File::after_create($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | ($tmpl->{name}) = $tmpl->{path} =~ m{(\w+)\.\w+$} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | or $self->error("Can't extract part name from '%s'", [$tmpl->{path}]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | 576 | ▶ | if not defined $tmpl->{name} and defined $tmpl->{path}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
!defined($tmpl->{'name'}) && defined $tmpl->{'path'} && ((($tmpl->{'name'}) = $tmpl->{'path'} =~ /(\w+)\.\w+$/) || $self->error(q[Can't extract part name from '%s'], [$tmpl->{'path'}]))
not defined $tmpl->{"name"} and defined $tmpl->{"path"}
($tmpl->{"name"}) = $tmpl->{"path"} =~ /(\w+)\.\w+$/ or $self->error("Can't extract part name from '%s'", [$tmpl->{"path"}])
MC/DC0%0/4
!defined($tmpl->{'name'}) && defined $tmpl->{'path'} && ((($tmpl->{'name'}) = $tmpl->{'path'} =~ /(\w+)\.\w+$/) || $self->error(q[Can't extract part name from '%s'], [$tmpl->{'path'}]))
not defined $tmpl->{"name"}
defined $tmpl->{"path"}
($tmpl->{"name"}) = $tmpl->{"path"} =~ /(\w+)\.\w+$/
$self->error("Can't extract part name from '%s'", [$tmpl->{"path"}])
Truth table40%2/5
not(A) and B && C or D
A= not defined $tmpl->{"name"}B= defined $tmpl->{"path"}C= ($tmpl->{"name"}) = $tmpl->{"path"} =~ /(\w+)\.\w+$/D= $self->error("Can't extract part name from '%s'", [$tmpl->{"path"}])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | 644 | ▶ | sub YATT::Lite::Core::Template::reset { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reset: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | 644 | (my Template $tmpl) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | 644 | $tmpl->YATT::Lite::VFS::File::reset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | 644 | undef $tmpl->{_product}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | 644 | undef $tmpl->{_parse_ok}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | 644 | undef $tmpl->{subroutes}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | 644 | undef $tmpl->{_argmacro_dict}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | # delpkg($tmpl->{package}); # No way to avoid redef error. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | 1139 | ▶ | sub YATT::Lite::Core::Template::refresh { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
refresh: called CC=12 SCAR=24.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | 1139 | (my Template $tmpl, my MY $self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | 1139 | my $old_product = $tmpl->{_product}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | 1139 | my $old_signature; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | 1139 | ▶ | if ($tmpl->{path}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | 857 | printf STDERR "template_refresh(%s)\n", $tmpl->{path} if DEBUG_REBUILD; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | 857 | my $mtime = stat_mtime($tmpl->{path}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | 857 | ▶ | if (not defined $mtime) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | 0 | printf STDERR " => deleted\n" if DEBUG_REBUILD; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | 0 | return; # XXX: ファイルが消された | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | } elsif (not defined $tmpl->{mtime}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | 336 | if (DEBUG_REBUILD) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | printf STDERR " => found new. mtime($mtime) for tmpl=$tmpl\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | } elsif ($tmpl->{mtime} >= $mtime) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | 508 | if (DEBUG_REBUILD) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | printf STDERR " => use cached. mtime(was=$tmpl->{mtime}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | .", now=$mtime) for tmpl=$tmpl\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | 508 | ▶ | $self->refresh_deps_for($tmpl) if $self->{always_refresh_deps}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | 508 | return; # timestamp は、キャッシュと同じかむしろ古い | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | 13 | if (DEBUG_REBUILD) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | printf STDERR " => found update. mtime($mtime) for tmpl=$tmpl\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | 349 | $tmpl->{mtime} = $mtime; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | 349 | $old_signature = $tmpl->part_interface_signature; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | 349 | my $parser = $self->get_parser; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | # decl のみ parse. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | # XXX: $tmpl->{package} の指すパッケージをこの段階で map {undef $_} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | # すべきではないか? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | 349 | $parser->load_file_into($tmpl, $tmpl->{path}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | ▶ | } elsif ($tmpl->{string} and not $tmpl->{mtime}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$tmpl->{"string"} and not $tmpl->{"mtime"}
MC/DC50%1/2
$tmpl->{"string"} and not $tmpl->{"mtime"}
$tmpl->{"string"}
not $tmpl->{"mtime"}
Truth table66%2/3
A and not(B)
A= $tmpl->{"string"}B= not $tmpl->{"mtime"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | # To avoid recompilation, use mtime to express generated time. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | # Not so good. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | 273 | $tmpl->{mtime} = time; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | 273 | my $parser = $self->get_parser; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | $parser->load_string_into($tmpl, $tmpl->{string} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | 273 | , scheme => "data", path => $tmpl->{name}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | 9 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | # $tmpl->YATT::Lite::VFS::Folder::vivify_base_descs($self); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | # If there was products, rebuild it too. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | 590 | ▶ | foreach my $type ($old_product ? keys %$old_product : ()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | 13 | $self->find_product($type => $tmpl); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | # part 宣言のインタフェースが変わった場合は、コンパイル済みの依存元 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | # (呼び出し側) も作り直す。gen_putargs が呼び出し側のコンパイル時に | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | # 名前付き実引数を位置引数へ変換しているため。本文だけの変更なら | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | # 静的呼び出しの CODE slot 差し替えで追随するので再生成しない。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | # 依存元自体のソースは不変 (re-parse されない) なので、連鎖は一段で止まる。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | # GH-255 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | 590 | ▶ | if (($old_signature // '') ne $tmpl->part_interface_signature) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$old_signature // ""
MC/DC100%1/1
$old_signature // ""
$old_signature
Truth table100%2/2
A
A= $old_signature
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | 580 | $self->rebuild_products_of_dependents($tmpl); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | 590 | $tmpl; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | 939 | ▶ | sub YATT::Lite::Core::Template::part_interface_signature { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
part_interface_signature: called CC=9 SCAR=23.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | 939 | (my Template $tmpl) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | join ";", map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | 952 | my Part $part = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | my $args = join ",", map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | 1464 | ▶ | my $var = $part->{_arg_dict} && $part->{_arg_dict}{$_}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$part->{'_arg_dict'} && $part->{'_arg_dict'}{$_}
MC/DC0%0/2
$part->{'_arg_dict'} && $part->{'_arg_dict'}{$_}
$part->{'_arg_dict'}
$part->{'_arg_dict'}{$_}
Truth table33%1/3
A && B
A= $part->{'_arg_dict'}B= $part->{'_arg_dict'}{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | 1464 | ▶ | $_ . "=" . (($var && eval {$var->type->[0]}) // ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
$var && eval {
do {
$var->type->[0]
}
} // ""
$var and eval {
do {
$var->type->[0]
}
}
MC/DC0%0/2
$var && eval {
do {
$var->type->[0]
}
} // ""
$var
eval {
do {
$var->type->[0]
}
}
Truth table33%1/3
A and B
A= $varB= eval {
do {
$var->type->[0]
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | 952 | ▶ | } map {$_ ? @$_ : ()} $part->{_arg_order}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | 952 | ▶ | join "\0", $part->{kind} // '', $part->{name} // '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%2/4
$part->{"kind"} // ""
$part->{"name"} // ""
MC/DC0%0/1
$part->{"kind"} // ""
$part->{"kind"}
MC/DC0%0/1
$part->{"name"} // ""
$part->{"name"}
Truth table50%1/2
A
A= $part->{"kind"}
Truth table50%1/2
A
A= $part->{"name"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | , ($part->public ? 1 : 0), $args; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | 939 | ▶ | } @{$tmpl->{_partlist} || []}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$tmpl->{'_partlist'} || []
MC/DC100%1/1
$tmpl->{'_partlist'} || []
$tmpl->{'_partlist'}
Truth table100%2/2
A
A= $tmpl->{'_partlist'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | 580 | ▶ | sub rebuild_products_of_dependents { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rebuild_products_of_dependents: called CC=6 SCAR=19.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | 580 | (my MY $self, my Template $tmpl) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | 580 | foreach my Template $dep ($tmpl->list_dependents) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | 3 | my $old = $dep->{_product}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | 3 | ▶ | next unless $old and %$old; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$old and %$old
MC/DC0%0/2
$old and %$old
$old
%$old
Truth table33%1/3
A and B
A= $oldB= %$old
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | printf STDERR "rebuilding products of dependent: %s\n", $dep->{path} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | 3 | if DEBUG_REBUILD; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | 3 | $dep->{_product} = +{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | 3 | foreach my $type (keys %$old) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | 3 | eval { $self->find_product($type => $dep) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | 3 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | # 失敗した product を残すと古い stash が生き続けるので消しておく | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | 0 | delete $dep->{_product}{$type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | 0 | die $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | 911 | ▶ | sub YATT::Lite::Core::Widget::fixup { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fixup: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | 911 | (my Widget $widget, my Template $tmpl, my AbstParser $parser) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | 911 | foreach my $argName (@{$widget->{_arg_order}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | $widget->{_has_required_arg} = 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | 596 | ▶ | if $widget->{_arg_dict}{$argName}->is_required; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | 911 | ▶ | $widget->{_arg_dict}{$parser->{body_argument}} ||= do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$widget->{"_arg_dict"}{$parser->{"body_argument"}} ||= do {
() = $parser->parse_type_dflag_default($parser->{"body_argument_type"});
my $var = $parser->mkvar_at(undef, $type, $parser->{"body_argument"}, scalar @{$widget->{"_arg_order"} ||= [];});
$var->mark_body_argument;
$parser->set_dflag_default_to($var, @dflag_default);
push @{$$widget{"_arg_order"};}, $parser->{"body_argument"};
$var
}
MC/DC0%0/2
$widget->{"_arg_dict"}{$parser->{"body_argument"}} ||= do {
() = $parser->parse_type_dflag_default($parser->{"body_argument_type"});
my $var = $parser->mkvar_at(undef, $type, $parser->{"body_argument"}, scalar @{$widget->{"_arg_order"} ||= [];});
$var->mark_body_argument;
$parser->set_dflag_default_to($var, @dflag_default);
push @{$$widget{"_arg_order"};}, $parser->{"body_argument"};
$var
}
$widget->{"_arg_dict"}{$parser->{"body_argument"}}
do {
() = $parser->parse_type_dflag_default($parser->{"body_argument_type"});
my $var = $parser->mkvar_at(undef, $type, $parser->{"body_argument"}, scalar @{$widget->{"_arg_order"} ||= [];});
$var->mark_body_argument;
$parser->set_dflag_default_to($var, @dflag_default);
push @{$$widget{"_arg_order"};}, $parser->{"body_argument"};
$var
}
Truth table66%2/3
A ||= B
A= $widget->{"_arg_dict"}{$parser->{"body_argument"}}B= do {
() = $parser->parse_type_dflag_default($parser->{"body_argument_type"});
my $var = $parser->mkvar_at(undef, $type, $parser->{"body_argument"}, scalar @{$widget->{"_arg_order"} ||= [];});
$var->mark_body_argument;
$parser->set_dflag_default_to($var, @dflag_default);
push @{$$widget{"_arg_order"};}, $parser->{"body_argument"};
$var
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | my ($type, @dflag_default) = $parser->parse_type_dflag_default( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | $parser->{body_argument_type} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | 884 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | # lineno も入れるべきかも。 $widget->{bodyln} あたり. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | my $var = $parser->mkvar_at(undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | , $type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | , $parser->{body_argument} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | 884 | ▶ | , scalar @{$widget->{_arg_order} ||= []}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$widget->{"_arg_order"} ||= []
MC/DC0%0/1
$widget->{"_arg_order"} ||= []
$widget->{"_arg_order"}
Truth table50%1/2
A
A= $widget->{"_arg_order"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | # body_argument の印を付ける。public からは受理しないように. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | 884 | $var->mark_body_argument; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | 884 | $parser->set_dflag_default_to($var, @dflag_default); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | 884 | push @{$widget->{_arg_order}}, $parser->{body_argument}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | 884 | $var; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | 89 | ▶ | sub YATT::Lite::Core::Template::match_subroutes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
match_subroutes: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | 89 | my Template $tmpl = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | 89 | ▶ | return unless $tmpl->{subroutes}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | 87 | $tmpl->{subroutes}->match($_[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | 77 | ▶ | use YATT::Lite::Breakpoint (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | 77 | YATT::Lite::Breakpoint::break_load_core(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | 77 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||