| 1 | # | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # This file is part of Config-Model | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # This software is Copyright (c) 2005-2022 by Dominique Dumont. | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # This is free software, licensed under: | ||||||||||||||||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||||||||||||||||
| 8 | # The GNU Lesser General Public License, Version 2.1, February 1999 | ||||||||||||||||||||||||||||||||||||||||||
| 9 | # | ||||||||||||||||||||||||||||||||||||||||||
| 10 | package Config::Model::Role::Grab 2.169; | ||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | # ABSTRACT: Role to grab data from elsewhere in the tree | ||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 59 | ▶ | use Mouse::Role; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 59 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 59 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 59 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 59 | ▶ | use 5.20.0; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | 59 | ▶ | use List::MoreUtils qw/any/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 59 | ▶ | use Mouse::Util; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 59 | ▶ | use Log::Log4perl qw(get_logger :levels); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 59 | with "Config::Model::Role::Utils"; | |||||||||||||||||||||||||||||||||||||||||
| 25 | 59 | ▶ | use feature qw/signatures postderef/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | 59 | ▶ | no warnings qw/experimental::signatures experimental::postderef/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 59 | my $logger = get_logger("Grab"); | |||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 2844 | ▶ | sub unquote (@in) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unquote: called CC=7 SCAR=20.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 2844 | for (@in) { | |||||||||||||||||||||||||||||||||||||||||
| 33 | 8532 | ▶ | if (defined $_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 3406 | s/\\\\/\\/g; | |||||||||||||||||||||||||||||||||||||||||
| 35 | 3406 | ▶ | s/^"// && s/"$// && s!\\"!"!g; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
s/^"//u and s/"$//u
MC/DC50%1/2
s/^"//u and s/"$//u
s/^"//u
s/"$//u
Truth table66%2/3
A and B
A= s/^"//uB= s/"$//u
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 3406 | ▶ | s/^'// && s/'$// && s!\\'!'!g; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
s/^'//u and s/'$//u
MC/DC0%0/2
s/^'//u and s/'$//u
s/^'//u
s/'$//u
Truth table33%1/3
A and B
A= s/^'//uB= s/'$//u
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||
| 38 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 2844 | return @in; | |||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | 2844 | ▶ | sub _split_cmd ($cmd) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_split_cmd: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 2844 | $logger->trace("split on: ->$cmd<-"); | |||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 2844 | my $quoted_string = qr/ | |||||||||||||||||||||||||||||||||||||||||
| 46 | (?: "(?: \\" | [^"] )*? ") | # double quoted string | ||||||||||||||||||||||||||||||||||||||||||
| 47 | (?: '(?: \\' | [^'] )*? ') # single quoted string | ||||||||||||||||||||||||||||||||||||||||||
| 48 | /x; | ||||||||||||||||||||||||||||||||||||||||||
| 49 | # split in name, action, arg | ||||||||||||||||||||||||||||||||||||||||||
| 50 | 2844 | my @command = | |||||||||||||||||||||||||||||||||||||||||
| 51 | $cmd =~ / | ||||||||||||||||||||||||||||||||||||||||||
| 52 | ($quoted_string | \w[\w-]*)? # element name can be alone | ||||||||||||||||||||||||||||||||||||||||||
| 53 | (?: | ||||||||||||||||||||||||||||||||||||||||||
| 54 | (:) # action | ||||||||||||||||||||||||||||||||||||||||||
| 55 | ( | ||||||||||||||||||||||||||||||||||||||||||
| 56 | $quoted_string | | ||||||||||||||||||||||||||||||||||||||||||
| 57 | (?:[\w:\/\.\-\+]+) | ||||||||||||||||||||||||||||||||||||||||||
| 58 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 59 | )? | ||||||||||||||||||||||||||||||||||||||||||
| 60 | /x ; | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | #return @command; | ||||||||||||||||||||||||||||||||||||||||||
| 63 | 2844 | return unquote(@command); | |||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | ## Navigation | ||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | # accept commands like | ||||||||||||||||||||||||||||||||||||||||||
| 69 | # item:b -> go down a node, create a new node if necessary | ||||||||||||||||||||||||||||||||||||||||||
| 70 | # - climbs up | ||||||||||||||||||||||||||||||||||||||||||
| 71 | # ! climbs up to the top | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | # Now returns an object and not a value ! | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | 3356 | ▶ | sub grab ($self, @args) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
grab: called CC=54 SCAR=44.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 3356 | my %args = _resolve_arg_shortcut(\@args, 'steps'); | |||||||||||||||||||||||||||||||||||||||||
| 77 | 3356 | my ( $steps, $mode, $autoadd, $type, $grab_non_available, $check ) = | |||||||||||||||||||||||||||||||||||||||||
| 78 | ( undef, 'strict', 1, undef, 0, 'yes' ); | ||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | 3356 | ▶ | $steps = delete $args{steps} // delete $args{step}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
delete $args{"steps"} // delete $args{"step"}
MC/DC100%2/2
delete $args{"steps"} // delete $args{"step"}
delete $args{"steps"}
delete $args{"step"}
Truth table100%3/3
A // B
A= delete $args{"steps"}B= delete $args{"step"}
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 3356 | ▶ | $mode = delete $args{mode} if defined $args{mode}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | 3356 | ▶ | $autoadd = delete $args{autoadd} if defined $args{autoadd}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | $grab_non_available = delete $args{grab_non_available} | ||||||||||||||||||||||||||||||||||||||||||
| 84 | 3356 | ▶ | if defined $args{grab_non_available}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | 3356 | $type = delete $args{type}; # node, leaf or undef | |||||||||||||||||||||||||||||||||||||||||
| 86 | 3356 | $check = $self->_check_check( delete $args{check} ); | |||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | 3356 | ▶ | if ( defined $args{strict} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | carp "grab: deprecated parameter 'strict'. Use mode"; | |||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | $mode = delete $args{strict} ? 'strict' : 'adaptative'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | Config::Model::Exception::User->throw( | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 3356 | ▶ | object => $self, | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | message => "grab: unexpected parameter: " . join( ' ', keys %args ) ) if %args; | ||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | 3356 | ▶ | Config::Model::Exception::Internal->throw( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
ref $steps eq "ARRAY" or not ref $steps
MC/DC100%2/2
ref $steps eq "ARRAY" or not ref $steps
ref $steps eq "ARRAY"
not ref $steps
Truth table100%3/3
A or not(B)
A= ref $steps eq "ARRAY"B= not ref $steps
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | error => "grab: steps parameter must be a string " . "or an array ref" ) | ||||||||||||||||||||||||||||||||||||||||||
| 99 | unless ref $steps eq 'ARRAY' || ! ref $steps; | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | # accept commands, grep remove empty items left by spurious spaces | ||||||||||||||||||||||||||||||||||||||||||
| 102 | 3355 | ▶ | my $huge_string = ref $steps ? join( ' ', @$steps ) : $steps; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | 3355 | ▶ | return $self unless $huge_string; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | 3307 | my @command = _split_string($huge_string); | |||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | 3307 | my @saved = @command; | |||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 3307 | $logger->trace( | |||||||||||||||||||||||||||||||||||||||||
| 110 | "grab: executing '", | ||||||||||||||||||||||||||||||||||||||||||
| 111 | join( "' '", @command ), | ||||||||||||||||||||||||||||||||||||||||||
| 112 | "' on object '", | ||||||||||||||||||||||||||||||||||||||||||
| 113 | $self->name, "'" | ||||||||||||||||||||||||||||||||||||||||||
| 114 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | 3307 | my @found = ($self); | |||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | COMMAND: | ||||||||||||||||||||||||||||||||||||||||||
| 119 | 3307 | ▶ | while (@command) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | 5657 | ▶ | last if $mode eq 'step_by_step' and @saved > @command; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$mode eq "step_by_step" and @saved > @command
MC/DC100%2/2
$mode eq "step_by_step" and @saved > @command
$mode eq "step_by_step"
@saved > @command
Truth table100%3/3
A and B
A= $mode eq "step_by_step"B= @saved > @command
| |||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | 4918 | my $cmd = shift @command; | |||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | 4918 | my $obj = $found[-1]; | |||||||||||||||||||||||||||||||||||||||||
| 125 | 4918 | $logger->trace( "grab: executing cmd '$cmd' on object '", $obj->name, "($obj)'" ); | |||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | 4918 | ▶ | if ( $cmd eq '!' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 128 | 469 | push @found, $obj->grab_root(); | |||||||||||||||||||||||||||||||||||||||||
| 129 | 469 | next; | |||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | 4449 | ▶ | if ( $cmd =~ /^!([\w:]*)/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | 3 | my $ancestor = $obj->grab_ancestor($1); | |||||||||||||||||||||||||||||||||||||||||
| 134 | 3 | ▶ | if ( defined $ancestor ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | 3 | push @found, $ancestor; | |||||||||||||||||||||||||||||||||||||||||
| 136 | 3 | next; | |||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||
| 138 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | Config::Model::Exception::AncestorClass->throw( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 140 | object => $obj, | ||||||||||||||||||||||||||||||||||||||||||
| 141 | info => "grab called from '" | ||||||||||||||||||||||||||||||||||||||||||
| 142 | . $self->name | ||||||||||||||||||||||||||||||||||||||||||
| 143 | . "' with steps '@saved' looking for class $1" | ||||||||||||||||||||||||||||||||||||||||||
| 144 | ) if $mode eq 'strict'; | ||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | 4446 | ▶ | if ( $cmd =~ /^\?(\w[\w-]*)/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 150 | 5 | push @found, $obj->grab_ancestor_with_element_named($1); | |||||||||||||||||||||||||||||||||||||||||
| 151 | 4 | $cmd =~ s/^\?//; #remove the go up part | |||||||||||||||||||||||||||||||||||||||||
| 152 | 4 | unshift @command, $cmd; | |||||||||||||||||||||||||||||||||||||||||
| 153 | 4 | next; | |||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | 4441 | ▶ | if ( $cmd eq '-' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | 1594 | ▶ | if ( defined $obj->parent ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | 1594 | push @found, $obj->parent; | |||||||||||||||||||||||||||||||||||||||||
| 159 | 1594 | next; | |||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||
| 161 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | $logger->debug( "grab: ", $obj->name, " has no parent" ); | |||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | return $mode eq 'adaptative' ? $obj : undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | 2847 | ▶ | unless ( $obj->isa('Config::Model::Node') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$obj->isa("Config::Model::Node") or $obj->isa("Config::Model::WarpedNode")
MC/DC100%2/2
$obj->isa("Config::Model::Node") or $obj->isa("Config::Model::WarpedNode")
$obj->isa("Config::Model::Node")
$obj->isa("Config::Model::WarpedNode")
Truth table100%3/3
A or B
A= $obj->isa("Config::Model::Node")B= $obj->isa("Config::Model::WarpedNode")
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | or $obj->isa('Config::Model::WarpedNode') ) { | ||||||||||||||||||||||||||||||||||||||||||
| 169 | 3 | Config::Model::Exception::Model->throw( | |||||||||||||||||||||||||||||||||||||||||
| 170 | object => $obj, | ||||||||||||||||||||||||||||||||||||||||||
| 171 | message => "Cannot apply command '$cmd' on leaf item" | ||||||||||||||||||||||||||||||||||||||||||
| 172 | . " (full command is '@saved')" | ||||||||||||||||||||||||||||||||||||||||||
| 173 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | 2844 | my ( $name, $action, $arg ) = _split_cmd($cmd); | |||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||
| 178 | 2844 | ▶ | if ( defined $arg and $arg =~ /^"/ and $arg =~ /"$/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
defined $arg and $arg =~ /^"/u and $arg =~ /"$/u
defined $arg and $arg =~ /^"/u
MC/DC0%0/3
defined $arg and $arg =~ /^"/u and $arg =~ /"$/u
defined $arg
$arg =~ /^"/u
$arg =~ /"$/u
Truth table50%2/4
A and B and C
A= defined $argB= $arg =~ /^"/uC= $arg =~ /"$/u
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | $arg =~ s/^"//; # remove leading quote | |||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | $arg =~ s/"$//; # remove trailing quote | |||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | { | ||||||||||||||||||||||||||||||||||||||||||
| 184 | 59 | ▶ | no warnings "uninitialized"; ## no critic (TestingAndDebugging::ProhibitNoWarnings) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 185 | 2844 | $logger->debug("grab: cmd '$cmd' -> name '$name', action '$action', arg '$arg'"); | |||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | 2844 | ▶ | unless ( $obj->has_element(name => $name, autoadd => $autoadd) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | 220 | ▶ | if ( $mode eq 'step_by_step' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 190 | 93 | ▶ | return wantarray ? ( undef, @command ) : undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||
| 192 | elsif ( $mode eq 'loose' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 193 | 92 | return; | |||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||
| 195 | elsif ( $mode eq 'adaptative' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 196 | 1 | last; | |||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||
| 198 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 199 | 34 | Config::Model::Exception::UnknownElement->throw( | |||||||||||||||||||||||||||||||||||||||||
| 200 | object => $obj, | ||||||||||||||||||||||||||||||||||||||||||
| 201 | element => $name, | ||||||||||||||||||||||||||||||||||||||||||
| 202 | function => 'grab', | ||||||||||||||||||||||||||||||||||||||||||
| 203 | autoadd => $autoadd, | ||||||||||||||||||||||||||||||||||||||||||
| 204 | info => "grab called from '" . $self->name . "' with steps '@saved'" | ||||||||||||||||||||||||||||||||||||||||||
| 205 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | 2624 | ▶ | unless ( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$grab_non_available or $obj->is_element_available("name", $name)
MC/DC0%0/2
$grab_non_available or $obj->is_element_available("name", $name)
$grab_non_available
$obj->is_element_available("name", $name)
Truth table66%2/3
A or B
A= $grab_non_availableB= $obj->is_element_available("name", $name)
| |||||||||||||||||||||||||||||||||||||||||||
| 210 | $grab_non_available | ||||||||||||||||||||||||||||||||||||||||||
| 211 | or $obj->is_element_available( | ||||||||||||||||||||||||||||||||||||||||||
| 212 | name => $name, | ||||||||||||||||||||||||||||||||||||||||||
| 213 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 214 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | ▶ | if ( $mode eq 'step_by_step' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | return wantarray ? ( undef, @command ) : undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||
| 218 | elsif ( $mode eq 'loose' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||
| 221 | elsif ( $mode eq 'adaptative' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||
| 224 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | Config::Model::Exception::UnavailableElement->throw( | |||||||||||||||||||||||||||||||||||||||||
| 226 | object => $obj, | ||||||||||||||||||||||||||||||||||||||||||
| 227 | element => $name, | ||||||||||||||||||||||||||||||||||||||||||
| 228 | function => 'grab', | ||||||||||||||||||||||||||||||||||||||||||
| 229 | info => "grab called from '" . $self->name . "' with steps '@saved'" | ||||||||||||||||||||||||||||||||||||||||||
| 230 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | 2624 | my $next_obj = $obj->fetch_element( | |||||||||||||||||||||||||||||||||||||||||
| 235 | name => $name, | ||||||||||||||||||||||||||||||||||||||||||
| 236 | check => $check, | ||||||||||||||||||||||||||||||||||||||||||
| 237 | autoadd => $autoadd, | ||||||||||||||||||||||||||||||||||||||||||
| 238 | accept_hidden => $grab_non_available | ||||||||||||||||||||||||||||||||||||||||||
| 239 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||
| 241 | # create list or hash element only if autoadd is true | ||||||||||||||||||||||||||||||||||||||||||
| 242 | 2624 | ▶ | if ( defined $action | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
defined $action and $autoadd == 0 and not $next_obj->exists($arg)
defined $action and $autoadd == 0
MC/DC100%3/3
defined $action and $autoadd == 0 and not $next_obj->exists($arg)
defined $action
$autoadd == 0
not $next_obj->exists($arg)
Truth table100%4/4
A and B and not(C)
A= defined $actionB= $autoadd == 0C= not $next_obj->exists($arg)
| |||||||||||||||||||||||||||||||||||||||||||
| 243 | and $autoadd == 0 | ||||||||||||||||||||||||||||||||||||||||||
| 244 | and not $next_obj->exists($arg) ) { | ||||||||||||||||||||||||||||||||||||||||||
| 245 | 13 | ▶ | return if $mode eq 'loose'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 246 | 8 | ▶ | Config::Model::Exception::UnknownId->throw( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | object => $obj->fetch_element($name), | ||||||||||||||||||||||||||||||||||||||||||
| 248 | element => $name, | ||||||||||||||||||||||||||||||||||||||||||
| 249 | id => $arg, | ||||||||||||||||||||||||||||||||||||||||||
| 250 | function => 'grab' | ||||||||||||||||||||||||||||||||||||||||||
| 251 | ) unless $mode eq 'adaptative'; | ||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||
| 255 | 2611 | ▶ | if ( defined $action and not $next_obj->isa('Config::Model::AnyId') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $action and not $next_obj->isa("Config::Model::AnyId")
MC/DC100%2/2
defined $action and not $next_obj->isa("Config::Model::AnyId")
defined $action
not $next_obj->isa("Config::Model::AnyId")
Truth table100%3/3
A and not(B)
A= defined $actionB= not $next_obj->isa("Config::Model::AnyId")
| |||||||||||||||||||||||||||||||||||||||||||
| 256 | 7 | ▶ | return if $mode eq 'loose'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | Config::Model::Exception::Model->throw( | |||||||||||||||||||||||||||||||||||||||||
| 258 | object => $obj, | ||||||||||||||||||||||||||||||||||||||||||
| 259 | message => "Cannot apply command '$cmd' on non hash or non list item" | ||||||||||||||||||||||||||||||||||||||||||
| 260 | . " (full command is '@saved'). item is '" | ||||||||||||||||||||||||||||||||||||||||||
| 261 | . $next_obj->name . "'" | ||||||||||||||||||||||||||||||||||||||||||
| 262 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | # action can only be : | ||||||||||||||||||||||||||||||||||||||||||
| 267 | 2604 | ▶ | $next_obj = $next_obj->fetch_with_id(index => $arg, check => $check) if defined $action; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||
| 269 | 2604 | push @found, $next_obj; | |||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | # check element type | ||||||||||||||||||||||||||||||||||||||||||
| 273 | 3064 | ▶ | if ( defined $type ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 274 | 66 | ▶ | my @allowed = ref $type ? @$type : ($type); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 275 | 66 | ▶ | while ( @found and not any {$found[-1]->get_type eq $_} @allowed ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
Condition66%2/3
@found and not &any(sub {
$found[-1]->get_type eq $_;
}
, @allowed)
MC/DC50%1/2
@found and not &any(sub {
$found[-1]->get_type eq $_;
}
, @allowed)
@found
not &any(sub {
$found[-1]->get_type eq $_;
}
, @allowed)
Truth table66%2/3
A and not(B)
A= @foundB= not &any(sub {
$found[-1]->get_type eq $_;
}
, @allowed)
| |||||||||||||||||||||||||||||||||||||||||||
| 276 | 12 | ▶ | Config::Model::Exception::WrongType->throw( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 277 | object => $found[-1], | ||||||||||||||||||||||||||||||||||||||||||
| 278 | function => 'grab', | ||||||||||||||||||||||||||||||||||||||||||
| 279 | got_type => $found[-1]->get_type, | ||||||||||||||||||||||||||||||||||||||||||
| 280 | expected_type => $type, | ||||||||||||||||||||||||||||||||||||||||||
| 281 | info => "requested with steps '$steps'" | ||||||||||||||||||||||||||||||||||||||||||
| 282 | ) if $mode ne 'adaptative'; | ||||||||||||||||||||||||||||||||||||||||||
| 283 | 1 | pop @found; | |||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | 3053 | my $return = $found[-1]; | |||||||||||||||||||||||||||||||||||||||||
| 288 | 3053 | $logger->debug( "grab: returning object '", $return->name, "($return)'" ); | |||||||||||||||||||||||||||||||||||||||||
| 289 | 3053 | ▶ | return wantarray ? ( $return, @command ) : $return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||
| 292 | 386 | ▶ | sub grab_value ($self, @args) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
grab_value: called CC=8 SCAR=20.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 293 | 386 | my %args = _resolve_arg_shortcut(\@args, 'steps'); | |||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||
| 295 | 386 | my $obj = $self->grab(%args); | |||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | # Pb: may return a node. add another option to grab ?? | ||||||||||||||||||||||||||||||||||||||||||
| 298 | # to get undef value when needed? | ||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||
| 300 | 386 | ▶ | return if ( $args{mode} and $args{mode} eq 'loose' and not defined $obj ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$args{"mode"} and $args{"mode"} eq "loose" and not defined $obj
$args{"mode"} and $args{"mode"} eq "loose"
MC/DC66%2/3
$args{"mode"} and $args{"mode"} eq "loose" and not defined $obj
$args{"mode"}
$args{"mode"} eq "loose"
not defined $obj
Truth table75%3/4
A and B and not(C)
A= $args{"mode"}B= $args{"mode"} eq "loose"C= not defined $obj
| |||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||
| 302 | 384 | ▶ | if (not $obj->isa("Config::Model::Value") | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$obj->isa("Config::Model::Value") or $obj->isa("Config::Model::CheckList")
MC/DC100%2/2
$obj->isa("Config::Model::Value") or $obj->isa("Config::Model::CheckList")
$obj->isa("Config::Model::Value")
$obj->isa("Config::Model::CheckList")
Truth table100%3/3
A or B
A= $obj->isa("Config::Model::Value")B= $obj->isa("Config::Model::CheckList")
| |||||||||||||||||||||||||||||||||||||||||||
| 303 | and not $obj->isa("Config::Model::CheckList") | ||||||||||||||||||||||||||||||||||||||||||
| 304 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 305 | 1 | Config::Model::Exception::User->throw( | |||||||||||||||||||||||||||||||||||||||||
| 306 | object => $self, | ||||||||||||||||||||||||||||||||||||||||||
| 307 | message => "Cannot get a value from '". $obj->location . "'. ", | ||||||||||||||||||||||||||||||||||||||||||
| 308 | info => "grab arguments are '".join( "' '", @args ) . "'." | ||||||||||||||||||||||||||||||||||||||||||
| 309 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||
| 312 | 383 | my $value = $obj->fetch; | |||||||||||||||||||||||||||||||||||||||||
| 313 | 383 | ▶ | if ( $logger->is_debug ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 314 | 32 | ▶ | my $str = defined $value ? $value : '<undef>'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 315 | 32 | $logger->debug( "grab_value: returning value $str of object '", $obj->name ); | |||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||
| 317 | 383 | return $value; | |||||||||||||||||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | ▶ | sub grab_annotation ($self, @args) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
grab_annotation: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | return $self->grab(@args)->annotation; | |||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||
| 324 | 1208 | ▶ | sub grab_root { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
grab_root: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 325 | 1208 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 326 | 1208 | ▶ | return defined $self->parent | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 327 | ? $self->parent->grab_root | ||||||||||||||||||||||||||||||||||||||||||
| 328 | : $self; | ||||||||||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||
| 331 | 9 | ▶ | sub grab_ancestor { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
grab_ancestor: called CC=5 SCAR=16.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 332 | 9 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 333 | 9 | ▶ | my $class = shift || die "grab_ancestor: missing ancestor class"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || die('grab_ancestor: missing ancestor class')
MC/DC0%0/1
shift() || die('grab_ancestor: missing ancestor class')
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||
| 335 | 9 | ▶ | return $self if $self->get_type eq 'node' and $self->config_class_name eq $class; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->get_type eq "node" and $self->config_class_name eq $class
MC/DC100%2/2
$self->get_type eq "node" and $self->config_class_name eq $class
$self->get_type eq "node"
$self->config_class_name eq $class
Truth table100%3/3
A and B
A= $self->get_type eq "node"B= $self->config_class_name eq $class
| |||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||
| 337 | 6 | ▶ | return $self->{parent}->grab_ancestor($class) if defined $self->{parent}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||
| 341 | #internal. Used by grab with '?xxx' steps | ||||||||||||||||||||||||||||||||||||||||||
| 342 | 5 | ▶ | sub grab_ancestor_with_element_named { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
grab_ancestor_with_element_named: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 343 | 5 | my ( $self, $search, $type ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||
| 345 | 5 | my $obj = $self; | |||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | 5 | while (1) { | |||||||||||||||||||||||||||||||||||||||||
| 348 | 18 | $logger->debug( | |||||||||||||||||||||||||||||||||||||||||
| 349 | "grab_ancestor_with_element_named: executing cmd '?$search' on object " . $obj->name ); | ||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||
| 351 | 18 | my $obj_element_name = $obj->element_name; | |||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||
| 353 | 18 | ▶ | if ( $obj->isa('Config::Model::Node') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
$obj->isa("Config::Model::Node") and $obj->has_element("name", $search, "type", $type, "autoadd", 0)
MC/DC100%2/2
$obj->isa("Config::Model::Node") and $obj->has_element("name", $search, "type", $type, "autoadd", 0)
$obj->isa("Config::Model::Node")
$obj->has_element("name", $search, "type", $type, "autoadd", 0)
Truth table100%3/3
A and B
A= $obj->isa("Config::Model::Node")B= $obj->has_element("name", $search, "type", $type, "autoadd", 0)
| |||||||||||||||||||||||||||||||||||||||||||
| 354 | and $obj->has_element( name => $search, type => $type, autoadd => 0 ) ) { | ||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||
| 356 | # object contains the search element, we need to grab the | ||||||||||||||||||||||||||||||||||||||||||
| 357 | # searched object (i.e. the '?foo' part is done | ||||||||||||||||||||||||||||||||||||||||||
| 358 | 4 | return $obj; | |||||||||||||||||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||||||||||||||||
| 360 | elsif ( defined $obj->parent ) { | ||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||
| 362 | # going up | ||||||||||||||||||||||||||||||||||||||||||
| 363 | 13 | $obj = $obj->parent; | |||||||||||||||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||||||||||||||||
| 365 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 366 | # there's no more up to go to... | ||||||||||||||||||||||||||||||||||||||||||
| 367 | 1 | Config::Model::Exception::Model->throw( | |||||||||||||||||||||||||||||||||||||||||
| 368 | object => $self, | ||||||||||||||||||||||||||||||||||||||||||
| 369 | error => "Error: cannot grab '?$search'" . "from " . $self->name | ||||||||||||||||||||||||||||||||||||||||||
| 370 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | return; # should never be reached... | |||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||
| 376 | 59 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||
| 378 | __END__ | ||||||||||||||||||||||||||||||||||||||||||