| 1 | package Mason::Interp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 18 | $Mason::Interp::VERSION = '2.24'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 23 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 23 | ▶ | use Devel::GlobalDestruction; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 23 | ▶ | use File::Basename; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 23 | ▶ | use File::Path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 23 | ▶ | use File::Temp qw(tempdir); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 23 | ▶ | use Guard; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 23 | ▶ | use Mason::CodeCache; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 23 | ▶ | use Mason::Request; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 23 | ▶ | use Mason::Result; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 23 | ▶ | use Mason::Types; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | use Mason::Util | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 23 | ▶ | qw(can_load catdir catfile combine_similar_paths find_wanted first_index is_absolute json_decode mason_canon_path read_file taint_is_on touch_file uniq write_file); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 23 | ▶ | use Class::Load; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 23 | ▶ | use Memoize; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 23 | ▶ | use Moose::Util::TypeConstraints; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 23 | ▶ | use Mason::Moose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | ▶ | my $default_out = sub { print( $_[0] ) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 18 | my $next_id = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 18 | my $max_depth = 16; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | # Passed attributes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 108 | ▶ | has 'allow_globals' => ( isa => 'ArrayRef[Str]', default => sub { [] }, trigger => sub { shift->_validate_allow_globals } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 18 | has 'autobase_names' => ( isa => 'ArrayRef[Str]', lazy_build => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 18 | has 'autoextend_request_path' => ( isa => 'Bool', default => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 18 | has 'class_header' => ( default => '' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 18 | has 'comp_root' => ( required => 1, isa => 'Mason::Types::CompRoot', coerce => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 18 | has 'component_class_prefix' => ( lazy_build => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 18 | has 'data_dir' => ( lazy_build => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 18 | has 'dhandler_names' => ( isa => 'ArrayRef[Str]', lazy_build => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 18 | has 'index_names' => ( isa => 'ArrayRef[Str]', lazy_build => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 18 | has 'mason_root_class' => ( required => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 18 | has 'no_source_line_numbers' => ( default => 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 18 | has 'object_file_extension' => ( default => '.mobj' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | has 'plugins' => ( default => sub { [] } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 108 | ▶ | has 'pure_perl_extensions' => ( default => sub { ['.mp'] } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 18 | has 'static_source' => (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 18 | has 'static_source_touch_file' => (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 105 | ▶ | has 'top_level_extensions' => ( default => sub { ['.mc', '.mp'] } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | # Derived attributes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 18 | has 'allowed_globals_hash' => ( init_arg => undef, lazy_build => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 18 | has 'code_cache' => ( init_arg => undef, lazy_build => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 18 | has 'distinct_string_count' => ( init_arg => undef, default => 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 18 | has 'globals_package' => ( init_arg => undef, lazy_build => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 110 | ▶ | has 'id' => ( init_arg => undef, default => sub { $next_id++ } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 18 | has 'match_request_path' => ( init_arg => undef, lazy_build => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 18 | has 'pure_perl_regex' => ( lazy_build => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 18 | has 'request_params' => ( init_arg => undef ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 18 | has 'top_level_regex' => ( lazy_build => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | # Class overrides | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 18 | CLASS->_define_class_override_methods(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | # Allow access to current interp while in load() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 18 | our ($current_load_interp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 23 | ▶ | method current_load_interp () { $current_load_interp } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
current_load_interp: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | # BUILD | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 23 | ▶ | method BUILD ($params) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=6 SCAR=18.9
Subroutine
BUILD: called CC=6 SCAR=18.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | # Initialize static source mode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 61 | ▶ | if ( $self->{static_source} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | $self->{static_source_touch_file} ||= catfile( $self->data_dir, 'purge.dat' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$self->{"static_source_touch_file"} ||= catfile($self->data_dir, "purge.dat")
$self->{"static_source_touch_file"} ||= catfile($self->data_dir, "purge.dat")
MC/DC0%0/2
$self->{"static_source_touch_file"} ||= catfile($self->data_dir, "purge.dat")
$self->{"static_source_touch_file"}
catfile($self->data_dir, "purge.dat")
MC/DC0%0/2
$self->{"static_source_touch_file"} ||= catfile($self->data_dir, "purge.dat")
$self->{"static_source_touch_file"}
catfile($self->data_dir, "purge.dat")
Truth table0%0/3
A ||= B
A= $self->{"static_source_touch_file"}B= catfile($self->data_dir, "purge.dat")
Truth table0%0/3
A ||= B
A= $self->{"static_source_touch_file"}B= catfile($self->data_dir, "purge.dat")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | $self->{static_source_touch_lastmod} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | $self->_check_static_source_touch_file(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | # Separate out request parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 61 | $self->{request_params} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | my %is_request_attribute = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 61 | ▶ | map { ( $_->init_arg || $_->name, 1 ) } $self->request_class->meta->get_all_attributes(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%4/6
$_->init_arg || $_->name
$_->init_arg || $_->name
MC/DC0%0/2
$_->init_arg || $_->name
$_->init_arg
$_->name
MC/DC0%0/2
$_->init_arg || $_->name
$_->init_arg
$_->name
Truth table66%2/3
A || B
A= $_->init_argB= $_->name
Truth table66%2/3
A || B
A= $_->init_argB= $_->name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 61 | foreach my $key ( keys(%$params) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 275 | ▶ | if ( $is_request_attribute{$key} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | $self->{request_params}->{$key} = delete( $params->{$key} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | method _build_allowed_globals_hash () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
Subroutine
_build_allowed_globals_hash: not called CC=1 SCAR=5.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | my @allow_globals = uniq( @{ $self->allow_globals } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | my @canon_globals = map { join( "", $self->_parse_global_spec($_) ) } @allow_globals; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | return { map { ( $_, 1 ) } @canon_globals }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 23 | ▶ | method _build_globals_package () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_build_globals_package: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 1 | return "Mason::Globals" . $self->id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 23 | ▶ | method _build_autobase_names () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_build_autobase_names: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 24 | return [ map { "Base" . $_ } @{ $self->top_level_extensions } ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 23 | ▶ | method _build_code_cache () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_build_code_cache: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 80 | return $self->code_cache_class->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 23 | ▶ | method _build_component_class_prefix () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_build_component_class_prefix: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 75 | return "MC" . $self->id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 23 | ▶ | method _build_data_dir () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_build_data_dir: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 2 | return tempdir( 'mason-data-XXXX', TMPDIR => 1, CLEANUP => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 23 | ▶ | method _build_dhandler_names () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 79 | return [ map { "dhandler" . $_ } @{ $self->top_level_extensions } ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 23 | ▶ | method _build_index_names () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_build_index_names: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 74 | return [ map { "index" . $_ } @{ $self->top_level_extensions } ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 23 | ▶ | method _build_pure_perl_regex () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_build_pure_perl_regex: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 62 | my $extensions = $self->pure_perl_extensions; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 62 | ▶ | if ( !@$extensions ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 1 | return qr/(?!)/; # matches nothing | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 61 | my $regex = join( '|', @$extensions ) . '$'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 61 | return qr/$regex/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 23 | ▶ | method _build_top_level_regex () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_build_top_level_regex: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 76 | my $extensions = $self->top_level_extensions; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 76 | ▶ | if ( !@$extensions ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 2 | return qr/./; # matches everything | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 74 | my $regex = join( '|', @$extensions ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 74 | ▶ | if ( my @other_names = grep { !/$regex/ } @{ $self->dhandler_names }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 74 | @{ $self->index_names } ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 17 | $regex .= '|(?:/(?:' . join( '|', @other_names ) . '))'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 74 | $regex = '(?:' . $regex . ')$'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 74 | return qr/$regex/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | # PUBLIC METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 23 | ▶ | method all_paths ($dir_path) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 4 | ▶ | $dir_path ||= '/'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$dir_path ||= "/"
MC/DC100%1/1
$dir_path ||= "/"
$dir_path
Truth table100%2/2
A
A= $dir_path
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 4 | $self->_assert_absolute_path($dir_path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | return $self->_collect_paths_for_all_comp_roots( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 8 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 8 | my $root_path = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 8 | my $dir = $root_path . $dir_path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 8 | ▶ | return ( -d $dir ) ? find_wanted( sub { -f }, $dir ) : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 4 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 23 | ▶ | method comp_exists ($path) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
comp_exists: called CC=5 SCAR=16.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | # Canonicalize path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 590 | ▶ | croak "path required" if !defined($path); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 590 | $path = Mason::Util::mason_canon_path($path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 590 | ▶ | return ( ( $self->static_source && $self->code_cache->get($path) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$self->static_source and $self->code_cache->get($path) or $self->_source_file_for_path($path)
$self->static_source and $self->code_cache->get($path)
MC/DC33%1/3
$self->static_source and $self->code_cache->get($path) or $self->_source_file_for_path($path)
$self->static_source
$self->code_cache->get($path)
$self->_source_file_for_path($path)
Truth table60%3/5
A and B or C
A= $self->static_sourceB= $self->code_cache->get($path)C= $self->_source_file_for_path($path)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | || $self->_source_file_for_path($path) ) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 23 | ▶ | method flush_code_cache () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
flush_code_cache: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 89 | my $code_cache = $self->code_cache; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 89 | foreach my $key ( $code_cache->get_keys() ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 198 | $code_cache->remove($key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 23 | ▶ | method glob_paths ($glob_pattern) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
glob_paths: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | return $self->_collect_paths_for_all_comp_roots( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 6 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 6 | my $root_path = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 23 | ▶ | return glob( $root_path . $glob_pattern ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 3 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 18 | our $in_load = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 23 | ▶ | method load ($path) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
load: called CC=18 SCAR=29.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 679 | local $current_load_interp = $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 679 | my $code_cache = $self->code_cache; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | # Canonicalize path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 679 | ▶ | croak "path required" if !defined($path); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 679 | $path = Mason::Util::mason_canon_path($path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | # Quick check memory cache in static source mode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 679 | ▶ | if ( $self->static_source ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 14 | ▶ | if ( my $entry = $code_cache->get($path) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 4 | return $entry->{compc}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 675 | local $in_load = $in_load + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 675 | ▶ | if ( $in_load > $max_depth ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 1 | ▶ | die ">$max_depth levels deep in inheritance determination (inheritance cycle?)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | if $in_load >= $max_depth; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 674 | my $compile = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | my ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 674 | $default_parent_path, $source_file, $source_lastmod, $object_file, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | $object_lastmod, @source_stat, @object_stat | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 674 | ▶ | my $stat_source_file = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=17.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 674 | ▶ | if ( $source_file = $self->_source_file_for_path($path) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 300 | @source_stat = stat $source_file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 300 | ▶ | if ( @source_stat && !-f _ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@source_stat and not -f _
MC/DC0%0/2
@source_stat and not -f _
@source_stat
not -f _
Truth table33%1/3
A and not(B)
A= @source_statB= not -f _
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | die "source file '$source_file' exists but it is not a file"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 674 | ▶ | $source_lastmod = @source_stat ? $source_stat[9] : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 674 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 272 | ▶ | my $stat_object_file = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 272 | $object_file = $self->_object_file_for_path($path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 272 | @object_stat = stat $object_file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 272 | ▶ | if ( @object_stat && !-f _ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@object_stat and not -f _
MC/DC0%0/2
@object_stat and not -f _
@object_stat
not -f _
Truth table66%2/3
A and not(B)
A= @object_statB= not -f _
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | die "object file '$object_file' exists but it is not a file"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 272 | ▶ | $object_lastmod = @object_stat ? $object_stat[9] : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 674 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | # Determine source and object files and their modified times | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 674 | ▶ | $stat_source_file->() or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | # Determine default parent comp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 300 | $default_parent_path = $self->_default_parent_path($path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 300 | ▶ | if ( $self->static_source ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 9 | ▶ | if ( $stat_object_file->() ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | # If touch file is more recent than object file, we can't trust object file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 1 | ▶ | if ( $self->{static_source_touch_lastmod} >= $object_lastmod ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | # If source file is more recent, recompile. Otherwise, touch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | # the object file so it will be trusted. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 1 | ▶ | if ( $source_lastmod > $object_lastmod ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 1 | $compile = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | touch_file($object_file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 8 | $compile = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | # Check memory cache | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 291 | ▶ | if ( my $entry = $code_cache->get($path) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 57 | ▶ | if ( $entry->{source_lastmod} >= $source_lastmod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$entry->{"source_lastmod"} >= $source_lastmod and $entry->{"source_file"} eq $source_file and $entry->{"default_parent_path"} eq $default_parent_path
$entry->{"source_lastmod"} >= $source_lastmod and $entry->{"source_file"} eq $source_file
MC/DC66%2/3
$entry->{"source_lastmod"} >= $source_lastmod and $entry->{"source_file"} eq $source_file and $entry->{"default_parent_path"} eq $default_parent_path
$entry->{"source_lastmod"} >= $source_lastmod
$entry->{"source_file"} eq $source_file
$entry->{"default_parent_path"} eq $default_parent_path
Truth table75%3/4
A and B and C
A= $entry->{"source_lastmod"} >= $source_lastmodB= $entry->{"source_file"} eq $source_fileC= $entry->{"default_parent_path"} eq $default_parent_path
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | && $entry->{source_file} eq $source_file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | && $entry->{default_parent_path} eq $default_parent_path ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 35 | my $compc = $entry->{compc}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 35 | ▶ | if ( $entry->{superclass_signature} eq $self->_superclass_signature($compc) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 28 | return $compc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 29 | $code_cache->remove($path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | # Determine object file and its last modified time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 263 | $stat_object_file->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 263 | ▶ | $compile = ( !$object_lastmod || $object_lastmod < $source_lastmod ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
!$object_lastmod || $object_lastmod < $source_lastmod
MC/DC100%2/2
!$object_lastmod || $object_lastmod < $source_lastmod
!$object_lastmod
$object_lastmod < $source_lastmod
Truth table100%3/3
not(A) || B
A= !$object_lastmodB= $object_lastmod < $source_lastmod
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 272 | ▶ | $self->_compile_to_file( $source_file, $path, $object_file ) if $compile; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 246 | my $compc = $self->_comp_class_for_path($path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 246 | $self->_load_class_from_object_file( $compc, $object_file, $path, $default_parent_path ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 227 | $compc->meta->make_immutable(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | # Save component class in the cache. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 227 | $code_cache->set( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | $path, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | source_file => $source_file, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | source_lastmod => $source_lastmod, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | default_parent_path => $default_parent_path, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | compc => $compc, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | superclass_signature => $self->_superclass_signature($compc), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 227 | return $compc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 23 | ▶ | method _superclass_signature ($compc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_superclass_signature: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 262 | my @superclasses = $compc->meta->superclasses; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | # Recursively load the superclasses for an existing component class in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | # case they have changed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 262 | foreach my $superclass (@superclasses) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 262 | ▶ | if ( my $cmeta = $superclass->cmeta ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 71 | my $path = $cmeta->path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 71 | $self->load( $cmeta->path ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | # Return a unique signature representing the component class's superclasses | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | # and their versions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 262 | ▶ | return join( ",", map { join( "-", $_, $_->cmeta ? $_->cmeta->id : 0 ) } @superclasses ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | # Memoize comp_exists() and load() - this helps both with components used | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | # multiple times in a request, and with determining default parent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | # components. The memoize cache is cleared at the beginning of each | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | # request, or in static_source_mode, when the purge file is touched. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 18 | memoize('comp_exists'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 18 | memoize('load'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 23 | ▶ | method object_dir () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
object_dir: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 272 | return catdir( $self->data_dir, 'obj' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 23 | ▶ | method run () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
run: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 186 | my %request_params; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 186 | ▶ | if ( ref( $_[0] ) eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 11 | %request_params = %{ shift(@_) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 186 | my $path = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 186 | my $request = $self->_make_request(%request_params); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 186 | $request->run( $path, @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 23 | ▶ | method set_global () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
set_global: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 3 | my ( $spec, $value ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 3 | ▶ | croak "set_global expects a var name and value" unless $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 3 | my ( $sigil, $name ) = $self->_parse_global_spec($spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | croak "${sigil}${name} is not in the allowed globals list" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 3 | ▶ | unless $self->allowed_globals_hash->{"${sigil}${name}"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 2 | my $varname = sprintf( "%s::%s", $self->globals_package, $name ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 23 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 23 | ▶ | no warnings 'once'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 2 | $$varname = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | # MODIFIABLE METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 23 | ▶ | method DEMOLISH () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
DEMOLISH: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 111 | ▶ | return if in_global_destruction; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | # We have to check for code_cache slot directly, in case the object gets | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | # destroyed before it has been fully formed (e.g. missing required attr). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 111 | ▶ | $self->flush_code_cache() if defined( $self->{code_cache} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 23 | ▶ | method _compile ($source_file, $path) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_compile: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 241 | my $compilation = $self->compilation_class->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | source_file => $source_file, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | path => $path, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | interp => $self | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 241 | return $compilation->compile(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 23 | ▶ | method _compile_to_file ($source_file, $path, $object_file) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_compile_to_file: called CC=6 SCAR=18.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | # We attempt to handle several cases in which a file already exists | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | # and we wish to create a directory, or vice versa. However, not | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | # every case is handled; to be complete, mkpath would have to unlink | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | # any existing file in its way. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 237 | ▶ | if ( defined $object_file && !-f $object_file ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $object_file and not -f $object_file
MC/DC50%1/2
defined $object_file and not -f $object_file
defined $object_file
not -f $object_file
Truth table66%2/3
A and not(B)
A= defined $object_fileB= not -f $object_file
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 227 | my ($dirname) = dirname($object_file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 227 | ▶ | if ( !-d $dirname ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 97 | ▶ | unlink($dirname) if ( -e _ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 97 | mkpath( $dirname, 0, 0775 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 227 | ▶ | rmtree($object_file) if ( -d $object_file ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 237 | my $object_contents = $self->_compile( $source_file, $path ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 211 | $self->write_object_file( $object_file, $object_contents ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 23 | ▶ | method is_pure_perl_comp_path ($path) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
is_pure_perl_comp_path: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 241 | ▶ | return ( $path =~ $self->pure_perl_regex ) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 23 | ▶ | method is_top_level_comp_path ($path) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
is_top_level_comp_path: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 215 | ▶ | return ( $path =~ $self->top_level_regex ) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 23 | ▶ | method _load_class_from_object_file ($compc, $object_file, $path, $default_parent_path) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_load_class_from_object_file: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 246 | my $flags = $self->_extract_flags_from_object_file($object_file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 246 | ▶ | my $parent_compc = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition77%7/9
$self->_determine_parent_compc($path, $flags) || $default_parent_path eq '/' && $self->component_class || $self->load($default_parent_path)
$self->_determine_parent_compc($path, $flags) or $default_parent_path eq "/" and $self->component_class
$default_parent_path eq "/" and $self->component_class
MC/DC0%0/4
$self->_determine_parent_compc($path, $flags) || $default_parent_path eq '/' && $self->component_class || $self->load($default_parent_path)
$self->_determine_parent_compc($path, $flags)
$default_parent_path eq "/"
$self->component_class
$self->load($default_parent_path)
Truth table50%3/6
A or B and C || D
A= $self->_determine_parent_compc($path, $flags)B= $default_parent_path eq "/"C= $self->component_classD= $self->load($default_parent_path)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | $self->_determine_parent_compc( $path, $flags ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | || ( $default_parent_path eq '/' && $self->component_class ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | || $self->load($default_parent_path); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 229 | my $code = sprintf( 'package %s; use Moose; extends \'%s\'; do(\'%s\'); die $@ if $@', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | $compc, $parent_compc, $object_file ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 229 | ▶ | ($code) = ( $code =~ /^(.*)/s ) if taint_is_on(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 22 | ▶ | eval($code); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 229 | ▶ | die $@ if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 227 | $compc->_set_class_cmeta($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 227 | $self->modify_loaded_class($compc); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 23 | ▶ | method modify_loaded_class ($compc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 227 | $self->_add_default_wrap_method($compc); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 23 | ▶ | method write_object_file ($object_file, $object_contents) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
write_object_file: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 87 | write_file( $object_file, $object_contents ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | # Given /foo/bar, look for (by default): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | # /foo/bar/index.{mp,mc}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | # /foo/bar/dhandler.{mp,mc}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | # /foo/bar.{mp,mc}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | # /dhandler.{mp,mc}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | # /foo.{mp,mc} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 23 | ▶ | method _build_match_request_path ($interp:) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | # Create a closure for efficiency - all this data is immutable for an interp. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 84 | my @dhandler_subpaths = map { "/$_" } @{ $interp->dhandler_names }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | my $ignore_file_regex = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 84 | '(/' . join( "|", @{ $interp->autobase_names }, @{ $interp->dhandler_names } ) . ')$'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 84 | $ignore_file_regex = qr/$ignore_file_regex/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 84 | ▶ | my @autoextensions = $interp->autoextend_request_path ? @{ $interp->top_level_extensions } : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 84 | my @index_names = @{ $interp->index_names }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 84 | undef $interp; # So this doesn't end up in closure and cause cycle | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 207 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=16 SCAR=27.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 207 | my ( $request, $request_path ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 207 | my $interp = $request->interp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 207 | my $path_info = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 207 | my $declined_paths = $request->declined_paths; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 207 | my @index_subpaths = map { "/$_" } @index_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 207 | my $path = $request_path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 207 | my @tried_paths; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | # Deal with trailing slash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 207 | ▶ | $path_info = chop($path) if $path ne '/' && substr( $path, -1 ) eq '/'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$path ne "/" and substr($path, -1) eq "/"
MC/DC50%1/2
$path ne "/" and substr($path, -1) eq "/"
$path ne "/"
substr($path, -1) eq "/"
Truth table66%2/3
A and B
A= $path ne "/"B= substr($path, -1) eq "/"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 207 | while (1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | my @candidate_paths = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | ( $path_info eq '' && !@autoextensions ) ? ($path) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | : ( $path eq '/' ) ? ( @index_subpaths, @dhandler_subpaths ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | : ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 504 | ( grep { !/$ignore_file_regex/ } map { $path . $_ } @autoextensions ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 282 | ▶ | ( map { $path . $_ } ( @index_subpaths, @dhandler_subpaths ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
$path_info eq "" and not @autoextensions
MC/DC100%2/2
$path_info eq "" and not @autoextensions
$path_info eq ""
not @autoextensions
Truth table100%3/3
A and not(B)
A= $path_info eq ""B= not @autoextensions
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 282 | push( @tried_paths, @candidate_paths ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 282 | foreach my $candidate_path (@candidate_paths) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 658 | ▶ | next if $declined_paths->{$candidate_path}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 602 | ▶ | if ( my $compc = $interp->load($candidate_path) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 167 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%9/9
$compc->cmeta->is_top_level and $path_info eq "" || $compc->cmeta->is_dhandler || $compc->allow_path_info
$path_info eq "" or $compc->cmeta->is_dhandler or $compc->allow_path_info
$path_info eq "" or $compc->cmeta->is_dhandler
MC/DC100%4/4
$compc->cmeta->is_top_level and $path_info eq "" || $compc->cmeta->is_dhandler || $compc->allow_path_info
$compc->cmeta->is_top_level
$path_info eq ""
$compc->cmeta->is_dhandler
$compc->allow_path_info
Truth table100%5/5
A and B or C or D
A= $compc->cmeta->is_top_levelB= $path_info eq ""C= $compc->cmeta->is_dhandlerD= $compc->allow_path_info
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | $compc->cmeta->is_top_level | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | && ( $path_info eq '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | || $compc->cmeta->is_dhandler | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | || $compc->allow_path_info ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 160 | $request->{path_info} = $path_info; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 160 | return $compc->cmeta->path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 92 | ▶ | $interp->_top_level_not_found( $request_path, \@tried_paths ) if $path eq '/'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 75 | my $name = basename($path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 75 | ▶ | $path_info = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | $path_info eq '/' ? "$name/" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | : length($path_info) ? "$name/$path_info" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | : $name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 75 | $path = dirname($path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 75 | @index_subpaths = (); # only match index file in same directory | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 84 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | # PRIVATE METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 23 | ▶ | method _parse_global_spec () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_parse_global_spec: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 11 | my $spec = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 11 | ▶ | croak "only scalar globals supported at this time (not '$spec')" if $spec =~ /^[@%]/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 10 | $spec =~ s/^\$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 10 | ▶ | die "'$spec' is not a valid global var name" unless $spec =~ qr/^[[:alpha:]_]\w*$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 9 | return ( '$', $spec ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 23 | ▶ | method _add_default_wrap_method ($compc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_add_default_wrap_method: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | # Default wrap method for any component that doesn't define one. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | # Call inner() until we're back down at the page component ($self), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | # then call main(). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 227 | ▶ | unless ( $compc->meta->has_method('wrap') ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 222 | my $path = $compc->cmeta->path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 191 | ▶ | my $code = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 191 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 191 | ▶ | if ( $self->cmeta->path eq $path ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 155 | ▶ | if ( $self->can('main') ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 155 | $self->main(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | die sprintf( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | "component '%s' ('%s') was called but has no main method - did you forget to define 'main' or 'handle'?", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | $path, $compc->cmeta->source_file ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 36 | $compc->_inner(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 222 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 222 | $compc->meta->add_augment_method_modifier( wrap => $code ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 23 | ▶ | method _assert_absolute_path ($path) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 1478 | ▶ | $path ||= ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$path ||= ""
MC/DC0%0/1
$path ||= ""
$path
Truth table50%1/2
A
A= $path
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 1478 | ▶ | croak "'$path' is not an absolute path" unless is_absolute($path); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 23 | ▶ | method _check_static_source_touch_file () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | # Check the static_source_touch_file, if one exists, to see if it has | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | # changed since we last checked. If it has, clear the code cache. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 188 | ▶ | if ( my $touch_file = $self->static_source_touch_file ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 8 | ▶ | return unless -f $touch_file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 2 | my $touch_file_lastmod = ( stat($touch_file) )[9]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 2 | ▶ | if ( $touch_file_lastmod > $self->{static_source_touch_lastmod} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 2 | $self->flush_code_cache; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 2 | $self->{static_source_touch_lastmod} = $touch_file_lastmod; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 23 | ▶ | method _collect_paths_for_all_comp_roots ($code) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 7 | my @paths; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 7 | foreach my $root_path ( @{ $self->comp_root } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 14 | my $root_path_length = length($root_path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 14 | my @files = $code->($root_path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 14 | push( @paths, map { substr( $_, $root_path_length ) } @files ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 7 | return uniq(@paths); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 23 | ▶ | method _comp_class_for_path ($path) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_comp_class_for_path: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 246 | my $classname = substr( $path, 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 246 | $classname =~ s/[^\w]/_/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 246 | $classname =~ s/\//::/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 246 | $classname = join( "::", $self->component_class_prefix, $classname ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 246 | return $classname; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 23 | ▶ | method _construct_distinct_string () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_construct_distinct_string: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 2 | my $number = ++$self->{distinct_string_count}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 2 | my $str = $self->_construct_distinct_string_for_number($number); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 2 | return $str; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 23 | ▶ | method _construct_distinct_string_for_number ($number) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 2 | my $distinct_delimeter = "__MASON__"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 2 | return sprintf( "%s%d%s", $distinct_delimeter, $number, $distinct_delimeter ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 23 | ▶ | method _default_parent_path ($orig_path) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | # Given /foo/bar.mc, look for (by default): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | # /foo/Base.mp, /foo/Base.mc, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | # /Base.mp, /Base.mc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | # Split path into dir_path and base_name - validate that it has a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | # starting slash and ends with at least one non-slash character | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 300 | ▶ | my ( $dir_path, $base_name ) = ( $orig_path =~ m{^(/.*?)/?([^/]+)$} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | or die "not a valid absolute component path - '$orig_path'"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 300 | my $path = $dir_path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 300 | my @autobase_subpaths = map { "/$_" } @{ $self->autobase_names }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 300 | while (1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | my @candidate_paths = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | ( $path eq '/' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | ? @autobase_subpaths | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 468 | ▶ | : ( map { $path . $_ } @autobase_subpaths ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 468 | ▶ | if ( ( my $index = first_index { $_ eq $orig_path } @candidate_paths ) != -1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 47 | splice( @candidate_paths, 0, $index + 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 468 | foreach my $candidate_path (@candidate_paths) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 820 | ▶ | if ( $self->comp_exists($candidate_path) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 74 | return $candidate_path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 394 | ▶ | if ( $path eq '/' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 226 | return '/'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 168 | $path = dirname($path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 23 | ▶ | method _determine_parent_compc ($path, $flags) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 246 | my $parent_compc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 246 | ▶ | if ( exists( $flags->{extends} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 13 | my $extends = $flags->{extends}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 13 | ▶ | if ( defined($extends) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 11 | ▶ | $extends = mason_canon_path( join( "/", dirname($path), $extends ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | if substr( $extends, 0, 1 ) ne '/'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 11 | ▶ | $parent_compc = $self->load($extends) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | or die "could not load '$extends' for extends flag"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 2 | $parent_compc = $self->component_class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 237 | return $parent_compc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 23 | ▶ | method _extract_flags_from_object_file ($object_file) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_extract_flags_from_object_file: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 246 | my $flags = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 246 | ▶ | open( my $fh, "<", $object_file ) or die "could not open '$object_file': $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 246 | my $line = <$fh>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 246 | ▶ | if ( my ($flags_str) = ( $line =~ /\# FLAGS: (.*)/ ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 13 | $flags = json_decode($flags_str); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 246 | return $flags; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 23 | ▶ | method _flush_load_cache () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_flush_load_cache: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 382 | Memoize::flush_cache('comp_exists'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 382 | Memoize::flush_cache('load'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 23 | ▶ | method _make_request () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 187 | return $self->request_class->new( interp => $self, %{ $self->request_params }, @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 23 | ▶ | method _object_file_for_path ($path) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_object_file_for_path: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 272 | return catfile( $self->object_dir, ( split /\//, $path ) ) . $self->object_file_extension; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 23 | ▶ | method _source_file_for_path ($path) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_source_file_for_path: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 1288 | $self->_assert_absolute_path($path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 1287 | foreach my $root_path ( @{ $self->comp_root } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 1287 | my $source_file = $root_path . $path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 1287 | ▶ | return $source_file if -f $source_file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 943 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 23 | ▶ | method _top_level_not_found ($path, $tried_paths) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_top_level_not_found: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 17 | my @combined_paths = combine_similar_paths(@$tried_paths); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | Mason::Exception::TopLevelNotFound->throw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | error => sprintf( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | "could not resolve request path '%s'; searched for components (%s) under %s\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | $path, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 116 | ▶ | join( ", ", map { "'$_'" } @combined_paths ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 17 | @{ $self->comp_root } > 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 0 | ? "component roots " . join( ", ", map { "'$_'" } @{ $self->comp_root } ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | : "component root '" . $self->comp_root->[0] . "'" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | 23 | ▶ | method _validate_allow_globals () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | # Will build allowed_globals_hash and also validate the param | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 3 | $self->allowed_globals_hash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 18 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | # Class overrides. Put here at the bottom because it strangely messes up | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | # Perl line numbering if at the top. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 22 | ▶ | sub _define_class_override_methods { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_define_class_override_methods: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 22 | my %class_overrides = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | code_cache_class => 'CodeCache', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | compilation_class => 'Compilation', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | component_class => 'Component', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | component_class_meta_class => 'Component::ClassMeta', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | component_import_class => 'Component::Import', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | component_moose_class => 'Component::Moose', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | request_class => 'Request', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | result_class => 'Result', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | # e.g. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | # $method_name = component_moose_class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | # $base_method_name = base_component_moose_class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | # $name = Component::Moose | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | # $default_base_class = Mason::Component::Moose | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 22 | ▶ | while ( my ( $method_name, $name ) = each(%class_overrides) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 176 | my $base_method_name = "base_$method_name"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | 176 | has $method_name => ( init_arg => undef, lazy_build => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 176 | has $base_method_name => ( isa => 'Str', lazy_build => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | __PACKAGE__->meta->add_method( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 204 | ▶ | "_build_$method_name" => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_component_class: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 204 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | 204 | my $base_class = $self->$base_method_name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 204 | Class::Load::load_class($base_class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | 204 | return Mason::PluginManager->apply_plugins_to_class( $base_class, $name, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | $self->plugins ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 176 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | __PACKAGE__->meta->add_method( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 608 | ▶ | "_build_$base_method_name" => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_base_component_class: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | 608 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | my @candidates = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 608 | map { join( '::', $_, $name ) } ( uniq( $self->mason_root_class, 'Mason' ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | 608 | ▶ | my ($base_class) = grep { can_load($_) } @candidates | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | or die | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | sprintf( "cannot load %s for %s", join( ', ', @candidates ), $base_method_name ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 608 | return $base_class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 176 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 18 | __PACKAGE__->meta->make_immutable(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 18 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||