| 1 | package Treex::PML::Schema::Copy; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 9 | ▶ | use strict; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 9 | ▶ | use warnings; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 9 | ▶ | use vars qw($VERSION); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 9 | ▶ | BEGIN { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 9 | $VERSION='2.29'; # version template | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 9 | ▶ | no warnings 'uninitialized'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 9 | ▶ | use Carp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 9 | ▶ | use Treex::PML::Schema::Constants; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 9 | ▶ | use List::Util qw(first); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 9 | ▶ | use base qw(Treex::PML::Schema::XMLNode); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | ▶ | sub get_decl_type { return(PML_COPY_DECL); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_decl_type: not called CC=1 SCAR=6.9
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | ▶ | sub get_decl_type_str { return('copy'); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_decl_type_str: not called CC=1 SCAR=6.9
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | ▶ | sub simplify { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
simplify: called CC=15 SCAR=33.7
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | my ($copy,$opts)=@_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | ▶ | return if $opts->{no_copy}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 1 | my $template_name = $copy->{template}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 1 | my $owner = _lookup_upwards($copy->{-parent},'template',$template_name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 1 | ▶ | unless ($owner) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | die "Could not find template $template_name\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 1 | my $template = $owner->{template}{$template_name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | # print STDERR "Copying $copy->{template} as $copy->{prefix}\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 1 | ▶ | if (ref $template->{type}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 1 | my $parent = $copy->{-parent}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 1 | ▶ | my $prefix = $copy->{prefix} || ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$copy->{'prefix'} || ''
MC/DC0%0/1
$copy->{'prefix'} || ''
$copy->{'prefix'}
Truth table50%1/2
A
A= $copy->{'prefix'}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 1 | ▶ | $parent->{type}||={}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$parent->{"type"} ||= {}
MC/DC0%0/1
$parent->{"type"} ||= {}
$parent->{"type"}
Truth table50%1/2
A
A= $parent->{"type"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 1 | my (@new_types, @new_templates); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 1 | foreach my $t (values(%{$template->{type}})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 4 | my $new = $template->copy_decl($t); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 4 | _apply_prefix($copy,$template,$prefix,$new); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 4 | my $new2 = $parent->copy_decl($new); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 4 | push @new_types, $new2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 1 | foreach my $t (values(%{$template->{template}})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | my $new = $template->copy_decl($t); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | _apply_prefix($copy,$template,$prefix,$new); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | my $new2 = $parent->copy_decl($new); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | push @new_templates, $new2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 1 | for my $t (@new_types) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 4 | my $name = $prefix.$t->{-name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | die "Type $name copied from $template_name already exists\n" if | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | exists $parent->{type}{$name} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | or (exists $parent->{derive}{$name} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | and $parent->{derive}{$name}{type} ne $name) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 4 | ▶ | or exists $parent->{param}{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition44%4/9
exists $parent->{"type"}{$name} or exists $parent->{"derive"}{$name} and $parent->{"derive"}{$name}{"type"} ne $name or exists $parent->{"param"}{$name}
exists $parent->{"type"}{$name} or exists $parent->{"derive"}{$name} and $parent->{"derive"}{$name}{"type"} ne $name
exists $parent->{"derive"}{$name} and $parent->{"derive"}{$name}{"type"} ne $name
MC/DC0%0/4
exists $parent->{"type"}{$name} or exists $parent->{"derive"}{$name} and $parent->{"derive"}{$name}{"type"} ne $name or exists $parent->{"param"}{$name}
exists $parent->{"type"}{$name}
exists $parent->{"derive"}{$name}
$parent->{"derive"}{$name}{"type"} ne $name
exists $parent->{"param"}{$name}
Truth table33%2/6
A or B and C or D
A= exists $parent->{"type"}{$name}B= exists $parent->{"derive"}{$name}C= $parent->{"derive"}{$name}{"type"} ne $nameD= exists $parent->{"param"}{$name}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | # print STDERR "copying type $name into \n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 4 | $t->{-name}=$name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 4 | $parent->{type}{$name}=$t; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 1 | for my $t (@new_templates) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | my $name = $prefix.$t->{-name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | die "Template $name copied from $template_name already exists\n" if | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | ▶ | exists $parent->{template}{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | # print STDERR "copying template $name\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | $t->{-name}=$name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | $parent->{template}{$name}=$t; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | # traverse declarations as long as there is one | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | # containing a hash key $what or one occurring in an array-ref $what | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | # with a Hash value containing the key $name | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 3 | ▶ | sub _lookup_upwards { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_lookup_upwards: called CC=7 SCAR=20.9
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 3 | my ($parent, $what, $name)=@_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 3 | ▶ | if (ref($what) eq 'ARRAY') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 2 | ▶ | while ($parent) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | return $parent if | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 5 | ▶ | first { (ref($parent->{$_}) eq 'HASH') and exists($parent->{$_}{$name}) } @$what; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 3 | $parent = $parent->{-parent}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 1 | ▶ | while ($parent) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 1 | ▶ | return $parent if (ref($parent->{$what}) eq 'HASH') and exists($parent->{$what}{$name}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $parent->{$what} eq "HASH" and exists $parent->{$what}{$name}
MC/DC0%0/2
ref $parent->{$what} eq "HASH" and exists $parent->{$what}{$name}
ref $parent->{$what} eq "HASH"
exists $parent->{$what}{$name}
Truth table33%1/3
A and B
A= ref $parent->{$what} eq "HASH"B= exists $parent->{$what}{$name}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | $parent = $parent->{-parent}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 11 | ▶ | sub _apply_prefix { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_apply_prefix: called CC=24 SCAR=37.4
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 11 | my ($copy,$template,$prefix,$type) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 11 | ▶ | if (ref($type)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 11 | ▶ | if (UNIVERSAL::isa($type,'HASH')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 11 | ▶ | if (exists($type->{-name}) and $type->{-name} eq 'template') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $type->{"-name"} and $type->{"-name"} eq "template"
MC/DC0%0/2
exists $type->{"-name"} and $type->{"-name"} eq "template"
exists $type->{"-name"}
$type->{"-name"} eq "template"
Truth table66%2/3
A and B
A= exists $type->{"-name"}B= $type->{"-name"} eq "template"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | # hopefully a template | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | if ($type->{type}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | _apply_prefix($copy,$template,$prefix,$_) for (values %{$type->{type}}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 11 | my $ref = $type->{type}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 11 | ▶ | if (defined($ref) and length($ref)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $ref and length $ref
MC/DC50%1/2
defined $ref and length $ref
defined $ref
length $ref
Truth table66%2/3
A and B
A= defined $refB= length $ref
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 2 | my $owner = _lookup_upwards($type->{-parent},['type','derive','param'],$ref); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 2 | ▶ | if (defined $owner and $owner==$template) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $owner and $owner == $template
MC/DC0%0/2
defined $owner and $owner == $template
defined $owner
$owner == $template
Truth table33%1/3
A and B
A= defined $ownerB= $owner == $template
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | # the type is defined exactly on the level of the template | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 2 | ▶ | if (exists $copy->{let}{$ref}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 1 | my $let = $copy->{let}{$ref}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 1 | ▶ | if ($let->{type}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | $type->{type}=$let->{type} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 1 | delete $type->{type}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 1 | foreach my $d (qw(list alt structure container sequence cdata choice constant)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 8 | ▶ | if (exists $type->{$d}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | delete $type->{$d}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 1 | delete $type->{-decl}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 1 | delete $type->{-resolved}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 1 | foreach my $d (qw(list alt structure container sequence cdata choice constant)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 6 | ▶ | if (exists $let->{$d}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 1 | $type->{$d} = $type->copy_decl($let->{$d}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 1 | $type->{-decl}=$d; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 1 | last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 1 | $type->{type} = $prefix.$ref; # do apply prefix | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | $type->{type} = $prefix.$ref; # do apply prefix | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | # traverse descendant type declarations | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 11 | for my $d (qw(member attribute element)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 29 | ▶ | if (ref($type->{$d})) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 3 | _apply_prefix($copy,$template,$prefix,$_) for (values %{$type->{$d}}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 3 | return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 8 | for my $d (qw(list alt structure container sequence)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 36 | ▶ | if (ref($type->{$d})) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 3 | _apply_prefix($copy,$template,$prefix,$type->{$d}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 3 | return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | } elsif (UNIVERSAL::isa($type,'ARRAY')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | foreach my $d (@$type) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | _apply_prefix($copy,$template,$prefix,$d); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 9 | 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | __END__ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||