lib/Perl/ToPerl6/Config.pm

filter: Statementstmt 94.9% 395 / 416 Branchbran 81.8% 90 / 110 Conditioncond 71.4% 25 / 35 MC/DCmcdc 52.1% 12 / 23 Subroutinesub 97.2% 70 / 72 Podpod 100% 26 / 26 totaltotal 90.6% 618 / 682 CC 70 SCAR 16.2
CC
70
Cov
91%
_load_transformers
15.0
_validate_and_save_regex
10.0
_validate_and_save_detail
9.2
CRAP 5.0
« lib/Perl/ToPerl6/Exception/AggregateConfiguration.pm ↑ Summary lib/Perl/ToPerl6/Transformer/References/RewriteDereferences.pm »
1 package Perl::ToPerl6::Config;
2  
3 13 ▶use 5.006001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 13 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 13 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 13 ▶use English qw(-no_match_vars);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 13 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 13 ▶use List::MoreUtils qw(any none apply);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 13 ▶use Scalar::Util qw(blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 13 ▶use Perl::ToPerl6::Exception::AggregateConfiguration;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 13 ▶use Perl::ToPerl6::Exception::Configuration;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 13 ▶use Perl::ToPerl6::Exception::Configuration::Option::Global::ParameterValue;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 13 ▶use Perl::ToPerl6::Exception::Fatal::Internal qw{ throw_internal };
Subroutine BEGIN: called CC=1 SCAR=0.0
17 13 ▶use Perl::ToPerl6::TransformerFactory;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 13 ▶use Perl::ToPerl6::Theme qw( $RULE_INVALID_CHARACTER_REGEX cook_rule );
Subroutine BEGIN: called CC=1 SCAR=0.0
19 13 ▶use Perl::ToPerl6::UserProfile qw();
Subroutine BEGIN: called CC=1 SCAR=0.0
20 13 ▶use Perl::ToPerl6::Utils qw{
Subroutine BEGIN: called CC=1 SCAR=0.0
21 :booleans :characters :severities :internal_lookup :classification
22 :data_conversion
23 13 };
24 13 ▶use Perl::ToPerl6::Utils::Constants qw<
Subroutine BEGIN: called CC=1 SCAR=0.0
25 :profile_strictness
26 $_MODULE_VERSION_TERM_ANSICOLOR
27 13 >;
28 13 ▶use Perl::ToPerl6::Utils::DataConversion qw< boolean_to_number dor >;
Subroutine BEGIN: called CC=1 SCAR=0.0
29  
30 #-----------------------------------------------------------------------------
31  
32 13 Readonly::Scalar my $SINGLE_TRANSFORMER_CONFIG_KEY => 'single-transformer';
33  
34 #-----------------------------------------------------------------------------
35 # Constructor
36  
37 71 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
38  
39 71 my ( $class, %args ) = @_;
40 71 my $self = bless {}, $class;
41 71 $self->_init( %args );
42 67 return $self;
43 }
44  
45 #-----------------------------------------------------------------------------
46  
47 71 ▶sub _init {
Subroutine _init: called CC=7 SCAR=19.5
48 71 my ( $self, %args ) = @_;
49  
50 # -top or -theme imply that -necessity is 1, unless it is already defined
51 71 ▶ if ( defined $args{-top} || defined $args{-theme} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args{"-top"} or defined $args{"-theme"}) 7 64 71
Condition100%3/3
defined $args{"-top"} or defined $args{"-theme"}
l!l&&r!l&&!r
3464
MC/DC100%2/2
defined $args{"-top"} or defined $args{"-theme"}
defined $args{"-top"} defined $args{"-theme"}
Truth table100%3/3
A or B
A= defined $args{"-top"}B= defined $args{"-theme"}
ABresult
1X1
011
000
52 7 ▶ $args{-necessity} ||= $NECESSITY_LOWEST;
Condition66%2/3
$args{"-necessity"} ||= $Perl::ToPerl6::Config::NECESSITY_LOWEST
l!l&&r!l&&!r
430
MC/DC0%0/2
$args{"-necessity"} ||= $Perl::ToPerl6::Config::NECESSITY_LOWEST
$args{"-necessity"} $Perl::ToPerl6::Config::NECESSITY_LOWEST
Truth table66%2/3
A ||= B
A= $args{"-necessity"}B= $Perl::ToPerl6::Config::NECESSITY_LOWEST
ABresult
1X1
011
000
53 }
54  
55 71 my $errors = Perl::ToPerl6::Exception::AggregateConfiguration->new();
56  
57 # Construct the UserProfile to get default options.
58 71 my $profile_source = $args{-profile}; # Can be file path or data struct
59 71 my $profile = Perl::ToPerl6::UserProfile->new( -profile => $profile_source );
60 71 my $options_processor = $profile->options_processor();
61 71 $self->{_profile} = $profile;
62  
63 $self->_validate_and_save_profile_strictness(
64 71 $args{'-profile-strictness'},
65 $errors,
66 );
67  
68 # If given, these options should always have a true value.
69 $self->_validate_and_save_regex(
70 71 'include', $args{-include}, $options_processor->include(), $errors
71 );
72 $self->_validate_and_save_regex(
73 71 'exclude', $args{-exclude}, $options_processor->exclude(), $errors
74 );
75 $self->_validate_and_save_regex(
76 $SINGLE_TRANSFORMER_CONFIG_KEY,
77 71 $args{ qq/-$SINGLE_TRANSFORMER_CONFIG_KEY/ },
78 $options_processor->single_transformer(),
79 $errors,
80 );
81 $self->_validate_and_save_color_necessity(
82 71 'color_necessity_highest', $args{'-color-necessity-highest'},
83 $options_processor->color_necessity_highest(), $errors
84 );
85 $self->_validate_and_save_color_necessity(
86 71 'color_necessity_high', $args{'-color-necessity-high'},
87 $options_processor->color_necessity_high(), $errors
88 );
89 $self->_validate_and_save_color_necessity(
90 71 'color_necessity_medium', $args{'-color-necessity-medium'},
91 $options_processor->color_necessity_medium(), $errors
92 );
93 $self->_validate_and_save_color_necessity(
94 71 'color_necessity_low', $args{'-color-necessity-low'},
95 $options_processor->color_necessity_low(), $errors
96 );
97 $self->_validate_and_save_color_necessity(
98 71 'color_necessity_lowest', $args{'-color-necessity-lowest'},
99 $options_processor->color_necessity_lowest(), $errors
100 );
101  
102 71 $self->_validate_and_save_verbosity($args{-verbose}, $errors);
103 71 $self->_validate_and_save_necessity($args{-necessity}, $errors);
104 71 $self->_validate_and_save_detail($args{-detail}, $errors);
105 71 $self->_validate_and_save_top($args{-top}, $errors);
106 71 $self->_validate_and_save_theme($args{-theme}, $errors);
107 71 $self->_validate_and_save_pager($args{-pager}, $errors);
108 $self->_validate_and_save_program_extensions(
109 71 $args{'-program-extensions'}, $errors);
110  
111 # If given, these options can be true or false (but defined)
112 # We normalize these to numeric values by multiplying them by 1;
113 71 $self->{_force} = boolean_to_number( dor( $args{-force}, $options_processor->force() ) );
114 71 $self->{_in_place} = boolean_to_number( dor( $args{'-in-place'}, $options_processor->in_place() ) );
115 71 $self->{_only} = boolean_to_number( dor( $args{-only}, $options_processor->only() ) );
116 71 $self->{_color} = boolean_to_number( dor( $args{-color}, $options_processor->color() ) );
117  
118  
119 # Construct a Factory with the Profile
120 71 my $factory =
121 Perl::ToPerl6::TransformerFactory->new(
122 -profile => $profile,
123 -errors => $errors,
124 '-profile-strictness' => $self->profile_strictness(),
125 );
126 71 $self->{_factory} = $factory;
127  
128 # Initialize internal storage for Transformers
129 71 $self->{_all_transformers_enabled_or_not} = [];
130 71 $self->{_transformers} = [];
131  
132 # "NONE" means don't load any transformers
133 71 ▶ if ( not defined $profile_source or $profile_source ne 'NONE' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $profile_source or $profile_source ne "NONE") 30 41 71
Condition100%3/3
not defined $profile_source or $profile_source ne "NONE"
l!l&&r!l&&!r
22841
MC/DC100%2/2
not defined $profile_source or $profile_source ne "NONE"
not defined $profile_source $profile_source ne "NONE"
Truth table100%3/3
not(A) or B
A= not defined $profile_sourceB= $profile_source ne "NONE"
ABresult
1X1
011
000
134 # Heavy lifting here...
135 30 $self->_load_transformers($errors);
136 }
137  
138 71 ▶ if ( $errors->has_exceptions() ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($errors->has_exceptions) 4 67 71
139 4 $errors->rethrow();
140 }
141  
142 67 return $self;
143 }
144  
145 #-----------------------------------------------------------------------------
146  
147 908 ▶sub apply_transform {
Subroutine apply_transform: called CC=4 SCAR=13.9
Pod documented
148  
149 908 my ( $self, %args ) = @_;
150  
151 908 ▶ if ( not $args{-transformer} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($args{"-transformer"}) 1 907 908
152 1 throw_internal q{The -transformer argument is required};
153 }
154  
155 907 my $transformer = $args{-transformer};
156  
157 # If the -transformer is already a blessed object, then just add it directly.
158 907 ▶ if ( blessed $transformer ) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($transformer)) 905 2 907
159 905 $self->_apply_transform_if_enabled($transformer);
160 905 return $self;
161 }
162  
163 # NOTE: The "-config" option is supported for backward compatibility.
164 2 ▶ my $params = $args{-params} || $args{-config};
Condition66%2/3
$args{'-params'} || $args{'-config'}
l!l&&r!l&&!r
101
MC/DC50%1/2
$args{'-params'} || $args{'-config'}
$args{'-params'} $args{'-config'}
Truth table66%2/3
A || B
A= $args{'-params'}B= $args{'-config'}
ABresult
1X1
011
000
165  
166 2 my $factory = $self->{_factory};
167 2 my $transformer_object =
168 $factory->create_transformer(-name=>$transformer, -params=>$params);
169 1 $self->_apply_transform_if_enabled($transformer_object);
170  
171 1 return $self;
172 }
173  
174 #-----------------------------------------------------------------------------
175  
176 906 ▶sub _apply_transform_if_enabled {
Subroutine _apply_transform_if_enabled: called CC=3 SCAR=11.3
177 906 my ( $self, $transformer_object ) = @_;
178  
179 906 ▶ my $config = $transformer_object->__get_config()
Branch: 1 branch
BranchTrueFalseTotal
my $config = $transformer_object->__get_config or throw_internal("Transformer was not set up properly because it does not have a value for its config attribute.") 906 0 906
180 or throw_internal
181 q{Transformer was not set up properly because it does not have }
182 . q{a value for its config attribute.};
183  
184 906 push @{ $self->{_all_transformers_enabled_or_not} }, $transformer_object;
185 906 ▶ if ( $transformer_object->initialize_if_enabled( $config ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($transformer_object->initialize_if_enabled($config)) { } 906 0 906
186 906 $transformer_object->__set_enabled($TRUE);
187 906 push @{ $self->{_transformers} }, $transformer_object;
188 }
189 else {
190 0 $transformer_object->__set_enabled($FALSE);
191 }
192  
193 906 return;
194 }
195  
196 #-----------------------------------------------------------------------------
197  
198 30 ▶sub _load_transformers {
Subroutine _load_transformers: called CC=15 SCAR=27.1
199  
200 30 my ( $self, $errors ) = @_;
201 30 my $factory = $self->{_factory};
202 30 my @transformers = $factory->create_all_transformers( $errors );
203  
204 30 ▶ return if $errors->has_exceptions();
Branch: 1 branch
BranchTrueFalseTotal
if $errors->has_exceptions 2 28 30
205  
206 28 for my $transformer ( @transformers ) {
207  
208 # If -single-transformer is true, only load transformers that match it
209 1064 ▶ if ( $self->single_transformer() ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->single_transformer) 114 950 1064
210 114 ▶ if ( $self->_transformer_is_single_transformer( $transformer ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_transformer_is_single_transformer($transformer)) 39 75 114
211 39 $self->apply_transform( -transformer => $transformer );
212 }
213 114 next;
214 }
215  
216 # To load, or not to load -- that is the question.
217 950 ▶ my $load_me = $self->only() ? $FALSE : $TRUE;
Branch: 1 branch
BranchTrueFalseTotal
$self->only ? : 76 874 950
218  
219 950 ▶ $load_me = $FALSE if $self->_transformer_is_disabled( $transformer );
Branch: 1 branch
BranchTrueFalseTotal
if $self->_transformer_is_disabled($transformer) 3 947 950
220 950 ▶ $load_me = $TRUE if $self->_transformer_is_enabled( $transformer );
Branch: 1 branch
BranchTrueFalseTotal
if $self->_transformer_is_enabled($transformer) 48 902 950
221 950 ▶ $load_me = $FALSE if $self->_transformer_is_unimportant( $transformer );
Branch: 1 branch
BranchTrueFalseTotal
if $self->_transformer_is_unimportant($transformer) 2 948 950
222 950 ▶ $load_me = $FALSE if not $self->_transformer_is_thematic( $transformer );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_transformer_is_thematic($transformer) 48 902 950
223 950 ▶ $load_me = $TRUE if $self->_transformer_is_included( $transformer );
Branch: 1 branch
BranchTrueFalseTotal
if $self->_transformer_is_included($transformer) 2 948 950
224 950 ▶ $load_me = $FALSE if $self->_transformer_is_excluded( $transformer );
Branch: 1 branch
BranchTrueFalseTotal
if $self->_transformer_is_excluded($transformer) 8 942 950
225  
226  
227 950 ▶ next if not $load_me;
Branch: 1 branch
BranchTrueFalseTotal
unless $load_me 84 866 950
228 866 $self->apply_transform( -transformer => $transformer );
229 }
230  
231 # When using -single-transformer, only one transformer should ever be loaded.
232 28 ▶ if ($self->single_transformer() && scalar $self->transformers() != 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->single_transformer and scalar $self->transformers != 1) 2 26 28
Condition100%3/3
$self->single_transformer and scalar $self->transformers != 1
!ll&&!rl&&r
2512
MC/DC100%2/2
$self->single_transformer and scalar $self->transformers != 1
$self->single_transformer scalar $self->transformers != 1
Truth table100%3/3
A and B
A= $self->single_transformerB= scalar $self->transformers != 1
ABresult
0X0
100
111
233 2 $self->_add_single_transformer_exception_to($errors);
234 }
235  
236 28 return;
237 }
238  
239 #-----------------------------------------------------------------------------
240  
241 950 ▶sub _transformer_is_disabled {
Subroutine _transformer_is_disabled: called CC=1 SCAR=0.0
242 950 my ($self, $transformer) = @_;
243 950 my $profile = $self->_profile();
244 950 return $profile->transformer_is_disabled( $transformer );
245 }
246  
247 #-----------------------------------------------------------------------------
248  
249 950 ▶sub _transformer_is_enabled {
Subroutine _transformer_is_enabled: called CC=1 SCAR=0.0
250 950 my ($self, $transformer) = @_;
251 950 my $profile = $self->_profile();
252 950 return $profile->transformer_is_enabled( $transformer );
253 }
254  
255 #-----------------------------------------------------------------------------
256  
257 950 ▶sub _transformer_is_thematic {
Subroutine _transformer_is_thematic: called CC=1 SCAR=0.0
258 950 my ($self, $transformer) = @_;
259 950 my $theme = $self->theme();
260 950 return $theme->transformer_is_thematic( -transformer => $transformer );
261 }
262  
263 #-----------------------------------------------------------------------------
264  
265 950 ▶sub _transformer_is_unimportant {
Subroutine _transformer_is_unimportant: called CC=1 SCAR=0.0
266 950 my ($self, $transformer) = @_;
267 950 my $transformer_necessity = $transformer->get_necessity();
268 950 my $min_necessity = $self->{_necessity};
269 950 return $transformer_necessity < $min_necessity;
270 }
271  
272 #-----------------------------------------------------------------------------
273  
274 950 ▶sub _transformer_is_included {
Subroutine _transformer_is_included: called CC=1 SCAR=0.0
275 950 my ($self, $transformer) = @_;
276 950 my $transformer_long_name = ref $transformer;
277 950 my @inclusions = $self->include();
278 950 ▶ return any { $transformer_long_name =~ m/$_/ixms } @inclusions;
Subroutine __ANON__: called CC=1 SCAR=0.0
279 }
280  
281 #-----------------------------------------------------------------------------
282  
283 950 ▶sub _transformer_is_excluded {
Subroutine _transformer_is_excluded: called CC=1 SCAR=0.0
284 950 my ($self, $transformer) = @_;
285 950 my $transformer_long_name = ref $transformer;
286 950 my @exclusions = $self->exclude();
287 950 ▶ return any { $transformer_long_name =~ m/$_/ixms } @exclusions;
Subroutine __ANON__: called CC=1 SCAR=0.0
288 }
289  
290 #-----------------------------------------------------------------------------
291  
292 114 ▶sub _transformer_is_single_transformer {
Subroutine _transformer_is_single_transformer: called CC=2 SCAR=7.0
293 114 my ($self, $transformer) = @_;
294  
295 114 my @patterns = $self->single_transformer();
296 114 ▶ return if not @patterns;
Branch: 1 branch
BranchTrueFalseTotal
unless @patterns 0 114 114
297  
298 114 my $transformer_long_name = ref $transformer;
299 114 ▶ return any { $transformer_long_name =~ m/$_/ixms } @patterns;
Subroutine __ANON__: called CC=1 SCAR=0.0
300 }
301  
302 #-----------------------------------------------------------------------------
303  
304 16 ▶sub _new_global_value_exception {
Subroutine _new_global_value_exception: called CC=1 SCAR=0.0
305 16 my ($self, @args) = @_;
306  
307 return
308 16 Perl::ToPerl6::Exception::Configuration::Option::Global::ParameterValue
309 ->new(@args);
310 }
311  
312 #-----------------------------------------------------------------------------
313  
314 2 ▶sub _add_single_transformer_exception_to {
Subroutine _add_single_transformer_exception_to: called CC=2 SCAR=6.9
315 2 my ($self, $errors) = @_;
316  
317 2 my $message_suffix = $EMPTY;
318 2 my $patterns = join q{", "}, $self->single_transformer();
319  
320 2 ▶ if (scalar $self->transformers() == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar $self->transformers == 0) { } 1 1 2
321 1 $message_suffix =
322 q{did not match any transformers (in combination with }
323 . q{other transformer restrictions).};
324 }
325 else {
326 1 $message_suffix = qq{matched multiple transformers:\n\t};
327 1 ▶ $message_suffix .= join qq{,\n\t}, apply { chomp } sort $self->transformers();
Subroutine __ANON__: called CC=1 SCAR=0.0
328 }
329  
330 2 $errors->add_exception(
331 $self->_new_global_value_exception(
332 option_name => $SINGLE_TRANSFORMER_CONFIG_KEY,
333 option_value => $patterns,
334 message_suffix => $message_suffix,
335 )
336 );
337  
338 2 return;
339 }
340  
341 #-----------------------------------------------------------------------------
342  
343 213 ▶sub _validate_and_save_regex {
Subroutine _validate_and_save_regex: called CC=10 SCAR=23.0
344 213 my ($self, $option_name, $args_value, $default_value, $errors) = @_;
345  
346 213 my $full_option_name;
347 my $source;
348 213 my @regexes;
349  
350 213 ▶ if ($args_value) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args_value) 6 207 213
351 6 $full_option_name = "-$option_name";
352  
353 6 ▶ if (ref $args_value) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $args_value) { } 3 3 6
354 3 @regexes = @{ $args_value };
355 }
356 else {
357 3 @regexes = ( $args_value );
358 }
359 }
360  
361 213 ▶ if (not @regexes) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@regexes) 207 6 213
362 207 $full_option_name = $option_name;
363 207 $source = $self->_profile()->source();
364  
365 207 ▶ if (ref $default_value) {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $default_value) { } 139 68 207
elsif ($default_value) { } 1 67 68
366 139 @regexes = @{ $default_value };
367 }
368 elsif ($default_value) {
369 1 @regexes = ( $default_value );
370 }
371 }
372  
373 213 my $found_errors;
374 213 foreach my $regex (@regexes) {
375 15 eval { qr/$regex/ixms }
376 15 ▶ or do {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { qr/$regex/imsx } } or do { my $cleaned_error = $Perl::ToPerl6::Config::EVAL_ERROR || "<unknown reason>"; $cleaned_error =~ s/ [ ] at [ ] .* Config [.] pm [ ] line [ ] \d+ [.] \n? \z/./msx; $errors->add_exception($self->_new_global_value_exception("option_name", $option_name, "option_value", $regex, "source", $source, "message_suffix", "is not valid: $cleaned_error")); $found_errors = 1 } 12 3 15
377 3 ▶ my $cleaned_error = $EVAL_ERROR || '<unknown reason>';
Condition50%1/2
$Perl::ToPerl6::Config::EVAL_ERROR || '<unknown reason>'
l!l
30
MC/DC0%0/1
$Perl::ToPerl6::Config::EVAL_ERROR || '<unknown reason>'
$Perl::ToPerl6::Config::EVAL_ERROR
Truth table50%1/2
A
A= $Perl::ToPerl6::Config::EVAL_ERROR
Aresult
11
00
378 3 $cleaned_error =~
379 s/ [ ] at [ ] .* Config [.] pm [ ] line [ ] \d+ [.] \n? \z/./xms;
380  
381 3 $errors->add_exception(
382 $self->_new_global_value_exception(
383 option_name => $option_name,
384 option_value => $regex,
385 source => $source,
386 message_suffix => qq{is not valid: $cleaned_error},
387 )
388 );
389  
390 3 $found_errors = 1;
391 }
392 }
393  
394 213 ▶ if (not $found_errors) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($found_errors) 210 3 213
395 210 my $option_key = $option_name;
396 210 $option_key =~ s/ - /_/xmsg;
397  
398 210 $self->{"_$option_key"} = \@regexes;
399 }
400  
401 213 return;
402 }
403  
404 #-----------------------------------------------------------------------------
405  
406 71 ▶sub _validate_and_save_profile_strictness {
Subroutine _validate_and_save_profile_strictness: called CC=3 SCAR=11.1
407 71 my ($self, $args_value, $errors) = @_;
408  
409 71 my $option_name;
410 my $source;
411 71 my $profile_strictness;
412  
413 71 ▶ if ($args_value) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args_value) { } 0 71 71
414 0 $option_name = '-profile-strictness';
415 0 $profile_strictness = $args_value;
416 }
417 else {
418 71 $option_name = 'profile-strictness';
419  
420 71 my $profile = $self->_profile();
421 71 $source = $profile->source();
422 71 $profile_strictness = $profile->options_processor()->profile_strictness();
423 }
424  
425 71 ▶ if ( not $PROFILE_STRICTNESSES{$profile_strictness} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($Perl::ToPerl6::Config::PROFILE_STRICTNESSES{$profile_strictness}) 1 70 71
426 1 $errors->add_exception(
427 $self->_new_global_value_exception(
428 option_name => $option_name,
429 option_value => $profile_strictness,
430 source => $source,
431 message_suffix => q{is not one of "}
432 . join ( q{", "}, (sort keys %PROFILE_STRICTNESSES) )
433 . q{".},
434 )
435 );
436  
437 1 $profile_strictness = $PROFILE_STRICTNESS_FATAL;
438 }
439  
440 71 $self->{_profile_strictness} = $profile_strictness;
441  
442 71 return;
443 }
444  
445 #-----------------------------------------------------------------------------
446  
447 71 ▶sub _validate_and_save_verbosity {
Subroutine _validate_and_save_verbosity: called CC=4 SCAR=14.1
448 71 my ($self, $args_value, $errors) = @_;
449  
450 71 my $option_name;
451 my $source;
452 71 my $verbosity;
453  
454 71 ▶ if ($args_value) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args_value) { } 0 71 71
455 0 $option_name = '-verbose';
456 0 $verbosity = $args_value;
457 }
458 else {
459 71 $option_name = 'verbose';
460  
461 71 my $profile = $self->_profile();
462 71 $source = $profile->source();
463 71 $verbosity = $profile->options_processor()->verbose();
464 }
465  
466 71 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if (is_integer($verbosity) and not is_valid_numeric_verbosity($verbosity)) { } 1 70 71
Condition66%2/3
is_integer($verbosity) and not is_valid_numeric_verbosity($verbosity)
!ll&&!rl&&r
0701
MC/DC50%1/2
is_integer($verbosity) and not is_valid_numeric_verbosity($verbosity)
is_integer($verbosity) not is_valid_numeric_verbosity($verbosity)
Truth table66%2/3
A and not(B)
A= is_integer($verbosity)B= not is_valid_numeric_verbosity($verbosity)
ABresult
0X0
100
111
467 is_integer($verbosity)
468 and not is_valid_numeric_verbosity($verbosity)
469 ) {
470 1 $errors->add_exception(
471 $self->_new_global_value_exception(
472 option_name => $option_name,
473 option_value => $verbosity,
474 source => $source,
475 message_suffix =>
476 'is not the number of one of the pre-defined verbosity formats.',
477 )
478 );
479 }
480 else {
481 70 $self->{_verbose} = $verbosity;
482 }
483  
484 71 return;
485 }
486  
487 #-----------------------------------------------------------------------------
488  
489 71 ▶sub _validate_and_save_necessity {
Subroutine _validate_and_save_necessity: called CC=6 SCAR=17.9
490 71 my ($self, $args_value, $errors) = @_;
491  
492 71 my $option_name;
493 my $source;
494 71 my $necessity;
495  
496 71 ▶ if ($args_value) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args_value) { } 17 54 71
497 17 $option_name = '-necessity';
498 17 $necessity = $args_value;
499 }
500 else {
501 54 $option_name = 'necessity';
502  
503 54 my $profile = $self->_profile();
504 54 $source = $profile->source();
505 54 $necessity = $profile->options_processor()->necessity();
506 }
507  
508 71 ▶ if ( is_integer($necessity) ) {
Branch: 2 branches
BranchTrueFalseTotal
if (is_integer($necessity)) { } 65 6 71
elsif (not &any(sub { $_ eq lc $necessity; } , @Perl::ToPerl6::Config::NECESSITY_NAMES)) { } 1 5 6
509 65 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($necessity >= $Perl::ToPerl6::Config::NECESSITY_LOWEST and $necessity <= $Perl::ToPerl6::Config::NECESSITY_HIGHEST) { } 64 1 65
Condition66%2/3
$necessity >= $Perl::ToPerl6::Config::NECESSITY_LOWEST and $necessity <= $Perl::ToPerl6::Config::NECESSITY_HIGHEST
!ll&&!rl&&r
0164
MC/DC50%1/2
$necessity >= $Perl::ToPerl6::Config::NECESSITY_LOWEST and $necessity <= $Perl::ToPerl6::Config::NECESSITY_HIGHEST
$necessity >= $Perl::ToPerl6::Config::NECESSITY_LOWEST $necessity <= $Perl::ToPerl6::Config::NECESSITY_HIGHEST
Truth table66%2/3
A and B
A= $necessity >= $Perl::ToPerl6::Config::NECESSITY_LOWESTB= $necessity <= $Perl::ToPerl6::Config::NECESSITY_HIGHEST
ABresult
0X0
100
111
510 $necessity >= $NECESSITY_LOWEST and $necessity <= $NECESSITY_HIGHEST
511 ) {
512 64 $self->{_necessity} = $necessity;
513 }
514 else {
515 1 $errors->add_exception(
516 $self->_new_global_value_exception(
517 option_name => $option_name,
518 option_value => $necessity,
519 source => $source,
520 message_suffix =>
521 "is not between $NECESSITY_LOWEST (low) and $NECESSITY_HIGHEST (high).",
522 )
523 );
524 }
525 }
526 20 ▶ elsif ( not any { $_ eq lc $necessity } @NECESSITY_NAMES ) {
Subroutine __ANON__: called CC=1 SCAR=0.0
527 1 $errors->add_exception(
528 $self->_new_global_value_exception(
529 option_name => $option_name,
530 option_value => $necessity,
531 source => $source,
532 message_suffix =>
533 q{is not one of the valid necessity names: "}
534 . join (q{", "}, @NECESSITY_NAMES)
535 . q{".},
536 )
537 );
538 }
539 else {
540 5 $self->{_necessity} = necessity_to_number($necessity);
541 }
542  
543 71 return;
544 }
545  
546 #-----------------------------------------------------------------------------
547  
548 71 ▶sub _validate_and_save_top {
Subroutine _validate_and_save_top: called CC=5 SCAR=16.1
549 71 my ($self, $args_value, $errors) = @_;
550  
551 71 my $option_name;
552 my $source;
553 71 my $top;
554  
555 71 ▶ if (defined $args_value and $args_value ne q{}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args_value and $args_value ne '') { } 2 69 71
Condition100%3/3
defined $args_value and $args_value ne ""
!ll&&!rl&&r
6812
MC/DC100%2/2
defined $args_value and $args_value ne ""
defined $args_value $args_value ne ""
Truth table100%3/3
A and B
A= defined $args_valueB= $args_value ne ""
ABresult
0X0
100
111
556 2 $option_name = '-top';
557 2 $top = $args_value;
558 }
559 else {
560 69 $option_name = 'top';
561  
562 69 my $profile = $self->_profile();
563 69 $source = $profile->source();
564 69 $top = $profile->options_processor()->top();
565 }
566  
567 71 ▶ if ( is_integer($top) and $top >= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (is_integer($top) and $top >= 0) { } 70 1 71
Condition66%2/3
is_integer($top) and $top >= 0
!ll&&!rl&&r
0170
MC/DC50%1/2
is_integer($top) and $top >= 0
is_integer($top) $top >= 0
Truth table66%2/3
A and B
A= is_integer($top)B= $top >= 0
ABresult
0X0
100
111
568 70 $self->{_top} = $top;
569 }
570 else {
571 1 $errors->add_exception(
572 $self->_new_global_value_exception(
573 option_name => $option_name,
574 option_value => $top,
575 source => $source,
576 message_suffix => q{is not a non-negative integer.},
577 )
578 );
579 }
580  
581 71 return;
582 }
583  
584 #-----------------------------------------------------------------------------
585  
586 71 ▶sub _validate_and_save_theme {
Subroutine _validate_and_save_theme: called CC=5 SCAR=16.3
587 71 my ($self, $args_value, $errors) = @_;
588  
589 71 my $option_name;
590 my $source;
591 71 my $theme_rule;
592  
593 71 ▶ if ($args_value) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args_value) { } 4 67 71
594 4 $option_name = '-theme';
595 4 $theme_rule = $args_value;
596 }
597 else {
598 67 $option_name = 'theme';
599  
600 67 my $profile = $self->_profile();
601 67 $source = $profile->source();
602 67 $theme_rule = $profile->options_processor()->theme();
603 }
604  
605 71 ▶ if ( $theme_rule =~ m/$RULE_INVALID_CHARACTER_REGEX/xms ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($theme_rule =~ /$Perl::ToPerl6::Config::RULE_INVALID_CHARACTER_REGEX/msx) { } 0 71 71
606 0 my $bad_character = $1;
607  
608 0 $errors->add_exception(
609 $self->_new_global_value_exception(
610 option_name => $option_name,
611 option_value => $theme_rule,
612 source => $source,
613 message_suffix =>
614 qq{contains an illegal character ("$bad_character").},
615 )
616 );
617 }
618 else {
619 71 my $rule_as_code = cook_rule($theme_rule);
620 71 $rule_as_code =~ s/ [\w\d]+ / 1 /gxms;
621  
622 # eval of an empty string does not reset $@ in Perl 5.6.
623 71 local $EVAL_ERROR = $EMPTY;
624 71 eval $rule_as_code;
625  
626 71 ▶ if ($EVAL_ERROR) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Perl::ToPerl6::Config::EVAL_ERROR) { } 1 70 71
627 1 $errors->add_exception(
628 $self->_new_global_value_exception(
629 option_name => $option_name,
630 option_value => $theme_rule,
631 source => $source,
632 message_suffix => q{is not syntactically valid.},
633 )
634 );
635 }
636 else {
637 eval {
638 $self->{_theme} =
639 70 Perl::ToPerl6::Theme->new( -rule => $theme_rule );
640 }
641 70 ▶ or do {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { $self->{"_theme"} = "Perl::ToPerl6::Theme"->new("-rule", $theme_rule) } } or do { $errors->add_exception_or_rethrow($Perl::ToPerl6::Config::EVAL_ERROR) } 70 0 70
642 0 $errors->add_exception_or_rethrow( $EVAL_ERROR );
643 };
644 }
645 }
646  
647 71 return;
648 }
649  
650 #-----------------------------------------------------------------------------
651  
652 71 ▶sub _validate_and_save_pager {
Subroutine _validate_and_save_pager: called CC=6 SCAR=21.9
653 71 my ($self, $args_value, $errors) = @_;
654  
655 71 my $pager;
656 71 ▶ if ( $args_value ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($args_value) { } 0 71 71
elsif ($ENV{'PERLMOGRIFY_PAGER'}) { } 0 71 71
657 0 ▶ $pager = defined $args_value ? $args_value : $EMPTY;
Branch: 1 branch
BranchTrueFalseTotal
defined $args_value ? : 0 0 0
658 }
659 elsif ( $ENV{PERLMOGRIFY_PAGER} ) {
660 0 $pager = $ENV{PERLMOGRIFY_PAGER};
661 }
662 else {
663 71 my $profile = $self->_profile();
664 71 $pager = $profile->options_processor()->pager();
665 }
666  
667 71 ▶ if ($pager eq '$PAGER') {
Branch: 1 branch
BranchTrueFalseTotal
if ($pager eq "\$PAGER") 0 71 71
668 0 $pager = $ENV{PAGER};
669 }
670 71 ▶ $pager ||= $EMPTY;
Condition33%1/3
$pager ||= $Perl::ToPerl6::Config::EMPTY
l!l&&r!l&&!r
0071
MC/DC0%0/2
$pager ||= $Perl::ToPerl6::Config::EMPTY
$pager $Perl::ToPerl6::Config::EMPTY
Truth table33%1/3
A ||= B
A= $pagerB= $Perl::ToPerl6::Config::EMPTY
ABresult
1X1
011
000
671  
672 71 $self->{_pager} = $pager;
673  
674 71 return;
675 }
676  
677 #-----------------------------------------------------------------------------
678  
679 71 ▶sub _validate_and_save_detail {
Subroutine _validate_and_save_detail: called CC=6 SCAR=22.2
680 71 my ($self, $args_value, $errors) = @_;
681  
682 71 my $option_name;
683 my $source;
684 71 my $detail;
685  
686 71 ▶ if ($args_value) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args_value) { } 0 71 71
687 0 $option_name = '-detail';
688 0 $detail = $args_value;
689 }
690 else {
691 71 $option_name = 'detail';
692  
693 71 my $profile = $self->_profile();
694 71 $source = $profile->source();
695 71 $detail = $profile->options_processor()->detail();
696 }
697  
698 71 ▶ if ( is_integer($detail) ) {
Branch: 2 branches
BranchTrueFalseTotal
if (is_integer($detail)) { } 71 0 71
elsif (not &any(sub { $_ eq lc $detail; } , @Perl::ToPerl6::Config::NECESSITY_NAMES)) { } 0 0 0
699 71 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($detail >= $Perl::ToPerl6::Config::NECESSITY_LOWEST and $detail <= $Perl::ToPerl6::Config::NECESSITY_HIGHEST) { } 71 0 71
Condition33%1/3
$detail >= $Perl::ToPerl6::Config::NECESSITY_LOWEST and $detail <= $Perl::ToPerl6::Config::NECESSITY_HIGHEST
!ll&&!rl&&r
0071
MC/DC0%0/2
$detail >= $Perl::ToPerl6::Config::NECESSITY_LOWEST and $detail <= $Perl::ToPerl6::Config::NECESSITY_HIGHEST
$detail >= $Perl::ToPerl6::Config::NECESSITY_LOWEST $detail <= $Perl::ToPerl6::Config::NECESSITY_HIGHEST
Truth table33%1/3
A and B
A= $detail >= $Perl::ToPerl6::Config::NECESSITY_LOWESTB= $detail <= $Perl::ToPerl6::Config::NECESSITY_HIGHEST
ABresult
0X0
100
111
700 $detail >= $NECESSITY_LOWEST and $detail <= $NECESSITY_HIGHEST
701 ) {
702 71 $self->{_detail} = $detail;
703 }
704 else {
705 0 $errors->add_exception(
706 $self->_new_global_value_exception(
707 option_name => $option_name,
708 option_value => $detail,
709 source => $source,
710 message_suffix =>
711 "is not between $NECESSITY_LOWEST (low) and $NECESSITY_HIGHEST (high).",
712 )
713 );
714 }
715 }
716 0 ▶ elsif ( not any { $_ eq lc $detail } @NECESSITY_NAMES ) {
Subroutine __ANON__: not called CC=1 SCAR=6.9
717 0 $errors->add_exception(
718 $self->_new_global_value_exception(
719 option_name => $option_name,
720 option_value => $detail,
721 source => $source,
722 message_suffix =>
723 q{is not one of the valid necessity names: "}
724 . join (q{", "}, @NECESSITY_NAMES)
725 . q{".},
726 )
727 );
728 }
729 else {
730 0 $self->{_detail} = necessity_to_number($detail);
731 }
732  
733 71 return;
734 }
735  
736 #-----------------------------------------------------------------------------
737  
738 355 ▶sub _validate_and_save_color_necessity {
Subroutine _validate_and_save_color_necessity: called CC=4 SCAR=13.9
739 355 my ($self, $option_name, $args_value, $default_value, $errors) = @_;
740  
741 355 my $source;
742 my $color_necessity;
743 355 my $full_option_name;
744  
745 355 ▶ if (defined $args_value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args_value) { } 5 350 355
746 5 $full_option_name = "-$option_name";
747 5 $color_necessity = lc $args_value;
748 }
749 else {
750 350 $full_option_name = $option_name;
751 350 $source = $self->_profile()->source();
752 350 $color_necessity = lc $default_value;
753 }
754 355 $color_necessity =~ s/ \s+ / /xmsg;
755 355 $color_necessity =~ s/ \A\s+ //xms;
756 355 $color_necessity =~ s/ \s+\z //xms;
757 355 $full_option_name =~ s/ _ /-/xmsg;
758  
759 # Should we really be validating this?
760 355 my $found_errors;
761 355 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if (eval { do { require Term::ANSIColor; "Term::ANSIColor"->VERSION($Perl::ToPerl6::Config::_MODULE_VERSION_TERM_ANSICOLOR); 1 } }) 355 0 355
762 eval {
763 355 require Term::ANSIColor;
764 355 Term::ANSIColor->VERSION( $_MODULE_VERSION_TERM_ANSICOLOR );
765 355 1;
766 }
767 ) {
768 355 $found_errors =
769 not Term::ANSIColor::colorvalid( words_from_string($color_necessity) );
770 }
771  
772 # If we do not have Term::ANSIColor we can not validate, but we store the
773 # values anyway for the benefit of Perl::ToPerl6::ProfilePrototype.
774  
775 355 ▶ if ($found_errors) {
Branch: 1 branch
BranchTrueFalseTotal
if ($found_errors) { } 5 350 355
776 5 $errors->add_exception(
777 $self->_new_global_value_exception(
778 option_name => $full_option_name,
779 option_value => $color_necessity,
780 source => $source,
781 message_suffix => 'is not valid.',
782 )
783 );
784 }
785 else {
786 350 my $option_key = $option_name;
787 350 $option_key =~ s/ - /_/xmsg;
788  
789 350 $self->{"_$option_key"} = $color_necessity;
790 }
791  
792 355 return;
793 }
794  
795 #-----------------------------------------------------------------------------
796  
797 71 ▶sub _validate_and_save_program_extensions {
Subroutine _validate_and_save_program_extensions: called CC=2 SCAR=7.3
798 71 my ($self, $args_value, $errors) = @_;
799  
800 71 delete $self->{_program_extensions_as_regexes};
801  
802 my $extension_list = q{ARRAY} eq ref $args_value ?
803 0 ▶ [map {words_from_string($_)} @{ $args_value }] :
Branch: 1 branch
BranchTrueFalseTotal
'ARRAY' eq ref $args_value ? : 0 71 71
804 $self->_profile()->options_processor()->program_extensions();
805  
806 71 my %program_extensions = hashify( @{ $extension_list } );
807  
808 71 $self->{_program_extensions} = [keys %program_extensions];
809  
810 71 return;
811  
812 }
813  
814 #-----------------------------------------------------------------------------
815 # Begin ACCESSSOR methods
816  
817 3002 ▶sub _profile {
Subroutine _profile: called CC=1 SCAR=0.0
818 3002 my ($self) = @_;
819 3002 return $self->{_profile};
820 }
821  
822 #-----------------------------------------------------------------------------
823  
824 1 ▶sub all_transformers_enabled_or_not {
Subroutine all_transformers_enabled_or_not: called CC=1 SCAR=0.0
Pod documented
825 1 my ($self) = @_;
826 1 return @{ $self->{_all_transformers_enabled_or_not} };
827 }
828  
829 #-----------------------------------------------------------------------------
830  
831 23 ▶sub transformers {
Subroutine transformers: called CC=1 SCAR=0.0
Pod documented
832 23 my ($self) = @_;
833 23 return @{ $self->{_transformers} };
834 }
835  
836 #-----------------------------------------------------------------------------
837  
838 954 ▶sub exclude {
Subroutine exclude: called CC=1 SCAR=0.0
Pod documented
839 954 my ($self) = @_;
840 954 return @{ $self->{_exclude} };
841 }
842  
843 #-----------------------------------------------------------------------------
844  
845 7 ▶sub detail {
Subroutine detail: called CC=1 SCAR=0.0
Pod documented
846 7 my ($self) = @_;
847 7 return $self->{_detail};
848 }
849  
850 #-----------------------------------------------------------------------------
851  
852 13 ▶sub force {
Subroutine force: called CC=1 SCAR=0.0
Pod documented
853 13 my ($self) = @_;
854 13 return $self->{_force};
855 }
856  
857 #-----------------------------------------------------------------------------
858  
859 954 ▶sub include {
Subroutine include: called CC=1 SCAR=0.0
Pod documented
860 954 my ($self) = @_;
861 954 return @{ $self->{_include} };
862 }
863  
864 #-----------------------------------------------------------------------------
865  
866 7 ▶sub in_place {
Subroutine in_place: called CC=1 SCAR=0.0
Pod documented
867 7 my ($self) = @_;
868 7 return $self->{_in_place};
869 }
870  
871 #-----------------------------------------------------------------------------
872  
873 958 ▶sub only {
Subroutine only: called CC=1 SCAR=0.0
Pod documented
874 958 my ($self) = @_;
875 958 return $self->{_only};
876 }
877  
878 #-----------------------------------------------------------------------------
879  
880 74 ▶sub profile_strictness {
Subroutine profile_strictness: called CC=1 SCAR=0.0
Pod documented
881 74 my ($self) = @_;
882 74 return $self->{_profile_strictness};
883 }
884  
885 #-----------------------------------------------------------------------------
886  
887 12 ▶sub necessity {
Subroutine necessity: called CC=1 SCAR=0.0
Pod documented
888 12 my ($self) = @_;
889 12 return $self->{_necessity};
890 }
891  
892 #-----------------------------------------------------------------------------
893  
894 1211 ▶sub single_transformer {
Subroutine single_transformer: called CC=1 SCAR=0.0
Pod documented
895 1211 my ($self) = @_;
896 1211 return @{ $self->{_single_transformer} };
897 }
898  
899 #-----------------------------------------------------------------------------
900  
901 957 ▶sub theme {
Subroutine theme: called CC=1 SCAR=0.0
Pod documented
902 957 my ($self) = @_;
903 957 return $self->{_theme};
904 }
905  
906 #-----------------------------------------------------------------------------
907  
908 13 ▶sub top {
Subroutine top: called CC=1 SCAR=0.0
Pod documented
909 13 my ($self) = @_;
910 13 return $self->{_top};
911 }
912  
913 #-----------------------------------------------------------------------------
914  
915 7 ▶sub verbose {
Subroutine verbose: called CC=1 SCAR=0.0
Pod documented
916 7 my ($self) = @_;
917 7 return $self->{_verbose};
918 }
919  
920 #-----------------------------------------------------------------------------
921  
922 6 ▶sub color {
Subroutine color: called CC=1 SCAR=0.0
Pod documented
923 6 my ($self) = @_;
924 6 return $self->{_color};
925 }
926  
927 #-----------------------------------------------------------------------------
928  
929 4 ▶sub pager {
Subroutine pager: called CC=1 SCAR=0.0
Pod documented
930 4 my ($self) = @_;
931 4 return $self->{_pager};
932 }
933  
934 #-----------------------------------------------------------------------------
935  
936 0 ▶sub site_transformer_names {
Subroutine site_transformer_names: not called CC=1 SCAR=6.9
Pod documented
937 0 return Perl::ToPerl6::TransformerFactory::site_transformer_names();
938 }
939  
940 #-----------------------------------------------------------------------------
941  
942 6 ▶sub color_necessity_highest {
Subroutine color_necessity_highest: called CC=1 SCAR=0.0
Pod documented
943 6 my ($self) = @_;
944 6 return $self->{_color_necessity_highest};
945 }
946  
947 #-----------------------------------------------------------------------------
948  
949 6 ▶sub color_necessity_high {
Subroutine color_necessity_high: called CC=1 SCAR=0.0
Pod documented
950 6 my ($self) = @_;
951 6 return $self->{_color_necessity_high};
952 }
953  
954 #-----------------------------------------------------------------------------
955  
956 6 ▶sub color_necessity_medium {
Subroutine color_necessity_medium: called CC=1 SCAR=0.0
Pod documented
957 6 my ($self) = @_;
958 6 return $self->{_color_necessity_medium};
959 }
960  
961 #-----------------------------------------------------------------------------
962  
963 6 ▶sub color_necessity_low {
Subroutine color_necessity_low: called CC=1 SCAR=0.0
Pod documented
964 6 my ($self) = @_;
965 6 return $self->{_color_necessity_low};
966 }
967  
968 #-----------------------------------------------------------------------------
969  
970 6 ▶sub color_necessity_lowest {
Subroutine color_necessity_lowest: called CC=1 SCAR=0.0
Pod documented
971 6 my ($self) = @_;
972 6 return $self->{_color_necessity_lowest};
973 }
974  
975 #-----------------------------------------------------------------------------
976  
977 9 ▶sub program_extensions {
Subroutine program_extensions: called CC=1 SCAR=0.0
Pod documented
978 9 my ($self) = @_;
979 9 return @{ $self->{_program_extensions} };
980 }
981  
982 #-----------------------------------------------------------------------------
983  
984 5 ▶sub program_extensions_as_regexes {
Subroutine program_extensions_as_regexes: called CC=2 SCAR=7.1
Pod documented
985 5 my ($self) = @_;
986  
987 0 return @{ $self->{_program_extensions_as_regexes} }
988 5 ▶ if $self->{_program_extensions_as_regexes};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_program_extensions_as_regexes"} 0 5 5
989  
990 5 my %program_extensions = hashify( $self->program_extensions() );
991 5 $program_extensions{'.PL'} = 1;
992 return @{
993 5 $self->{_program_extensions_as_regexes} = [
994 5 map { qr< @{[quotemeta $_]} \z >smx } sort keys %program_extensions
995 ]
996 };
997 }
998  
999 13 1;
1000  
1001 #-----------------------------------------------------------------------------
1002  
1003 __END__
« lib/Perl/ToPerl6/Exception/AggregateConfiguration.pm ↑ Summary lib/Perl/ToPerl6/Transformer/References/RewriteDereferences.pm »