| 1 | package Perl::ToPerl6::TransformerParameter::Behavior::StringList; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 23 | ▶ | use 5.006001; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 23 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 23 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 23 | ▶ | use Perl::ToPerl6::Utils qw{ :characters &words_from_string &hashify }; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 23 | ▶ | use base qw{ Perl::ToPerl6::TransformerParameter::Behavior }; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 3 | ▶ | sub initialize_parameter { | ||||||||||||||||||||||||||
|
Subroutine
initialize_parameter: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 14 | 3 | my ($self, $parameter, $specification) = @_; | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | # Unfortunately, this has to be kept as a reference, rather than a regular | ||||||||||||||||||||||||||||
| 17 | # array, due to a problem in Devel::Cycle | ||||||||||||||||||||||||||||
| 18 | # (http://rt.cpan.org/Ticket/Display.html?id=25360) which causes | ||||||||||||||||||||||||||||
| 19 | # t/92_memory_leaks.t to fall over. | ||||||||||||||||||||||||||||
| 20 | 3 | my $always_present_values = $specification->{list_always_present_values}; | |||||||||||||||||||||||||||
| 21 | $parameter->_get_behavior_values()->{always_present_values} = | ||||||||||||||||||||||||||||
| 22 | 3 | $always_present_values; | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 3 | ▶ | if ( not $always_present_values ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 25 | 2 | $always_present_values = []; | |||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | $parameter->_set_parser( | ||||||||||||||||||||||||||||
| 29 | 9 | ▶ | sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 30 | # Normally bad thing, obscuring a variable in a outer scope | ||||||||||||||||||||||||||||
| 31 | # with a variable with the same name is being done here in | ||||||||||||||||||||||||||||
| 32 | # order to remain consistent with the parser function interface. | ||||||||||||||||||||||||||||
| 33 | 9 | my ($transformer, $parameter, $config_string) = @_; | |||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 9 | my @values = @{$always_present_values}; | |||||||||||||||||||||||||||
| 36 | 9 | my $value_string = $parameter->get_default_string(); | |||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 9 | ▶ | if (defined $config_string) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 39 | 6 | $value_string = $config_string; | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 9 | ▶ | if ( defined $value_string ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | 8 | push @values, words_from_string($value_string); | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 9 | my %values = hashify(@values); | |||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 9 | $transformer->__set_parameter_value($parameter, \%values); | |||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 9 | return; | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | 3 | ); | |||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 3 | return; | |||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 0 | ▶ | sub generate_parameter_description { | ||||||||||||||||||||||||||
|
Subroutine
generate_parameter_description: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 60 | 0 | my ($self, $parameter) = @_; | |||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | my $always_present_values = | ||||||||||||||||||||||||||||
| 63 | 0 | $parameter->_get_behavior_values()->{always_present_values}; | |||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 0 | my $description = $parameter->_get_description_with_trailing_period(); | |||||||||||||||||||||||||||
| 66 | 0 | ▶ | if ( $description and $always_present_values ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$description and $always_present_values
MC/DC0%0/2
$description and $always_present_values
$description
$always_present_values
Truth table0%0/3
A and B
A= $descriptionB= $always_present_values
| |||||||||||||||||||||||||||||
| 67 | 0 | $description .= qq{\n}; | |||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 0 | ▶ | if ( $always_present_values ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 71 | 0 | $description .= 'Values that are always included: '; | |||||||||||||||||||||||||||
| 72 | 0 | $description .= join ', ', sort @{ $always_present_values }; | |||||||||||||||||||||||||||
| 73 | 0 | $description .= $PERIOD; | |||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 0 | return $description; | |||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 23 | 1; | |||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | __END__ | ||||||||||||||||||||||||||||