| 1 | 10 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 2 | 10 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 3 | 10 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 4 | 10 | ▶ | no warnings qw(uninitialized); | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||
| 6 | #======================================================== | ||||||||||||||||||||||||||||||||||||
| 7 | package XML::Pastor::Schema::Context; | ||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||
| 9 | 10 | ▶ | use Class::Accessor; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 10 | 10 | ▶ | use XML::Pastor::Stack; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 11 | 10 | ▶ | use XML::Pastor::Schema::Object; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||
| 13 | 10 | our @ISA = qw(Class::Accessor); | |||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||
| 15 | 10 | XML::Pastor::Schema::Context->mk_accessors( | |||||||||||||||||||||||||||||||||||
| 16 | qw( counter schema schema_url operation nodeStack targetNamespace)); | ||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||
| 18 | #------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||
| 19 | 24 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=14.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 20 | 24 | my $proto = shift; | |||||||||||||||||||||||||||||||||||
| 21 | 24 | ▶ | my $class = ref($proto) || $proto; | ||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||||||||||||||||||
| 22 | 24 | my $self = {@_}; | |||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||
| 24 | 24 | ▶ | unless ($self->{nodeStack}) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 25 | 24 | $self->{nodeStack} = XML::Pastor::Stack->new(); | |||||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||
| 28 | 24 | ▶ | unless (defined($self->{counter})) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 29 | 24 | $self->{counter} = 0; | |||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||
| 32 | 24 | return bless $self, $class; | |||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||
| 35 | #------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||
| 36 | 402 | ▶ | sub topNode { | ||||||||||||||||||||||||||||||||||
|
Subroutine
topNode: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 37 | 402 | my $self = shift; | |||||||||||||||||||||||||||||||||||
| 38 | 402 | return $self->nodeStack()->peek(); | |||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||
| 41 | #------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||
| 42 | 525 | ▶ | sub findNode { | ||||||||||||||||||||||||||||||||||
|
Subroutine
findNode: called CC=6 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 43 | 525 | my $self = shift; | |||||||||||||||||||||||||||||||||||
| 44 | 525 | my $args = {@_}; | |||||||||||||||||||||||||||||||||||
| 45 | 525 | my $class = $args->{class}; | |||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||
| 47 | 525 | my $nodeStack = $self->nodeStack(); | |||||||||||||||||||||||||||||||||||
| 48 | 525 | ▶ | for(my $i=0; $i< $nodeStack->count(); $i++) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 49 | 605 | my $node = $nodeStack->get($i); | |||||||||||||||||||||||||||||||||||
| 50 | # print "\n", ref($node); | ||||||||||||||||||||||||||||||||||||
| 51 | 605 | ▶ | if (ref($class) =~ /ARRAY/) { | ||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||
| 52 | 385 | foreach my $c (@$class) { | |||||||||||||||||||||||||||||||||||
| 53 | 522 | ▶ | if(UNIVERSAL::isa ($node, $c)) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 54 | 292 | return $node; | |||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||
| 57 | }elsif(UNIVERSAL::isa ($node, $class)) { | ||||||||||||||||||||||||||||||||||||
| 58 | 126 | return $node; | |||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||
| 61 | 107 | return undef; | |||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||
| 64 | #------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||
| 65 | 33 | ▶ | sub namePath { | ||||||||||||||||||||||||||||||||||
|
Subroutine
namePath: called CC=9 SCAR=23.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 66 | 33 | my $self = shift; | |||||||||||||||||||||||||||||||||||
| 67 | 33 | my $args = {@_}; | |||||||||||||||||||||||||||||||||||
| 68 | 33 | ▶ | my $separator = $args->{separator} || '/'; | ||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'separator'} || '/'
MC/DC0%0/1
$args->{'separator'} || '/'
$args->{'separator'}
Truth table50%1/2
A
A= $args->{'separator'}
| |||||||||||||||||||||||||||||||||||||
| 69 | 33 | my @names =(); | |||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||
| 71 | 33 | my $nodeStack = $self->nodeStack(); | |||||||||||||||||||||||||||||||||||
| 72 | 33 | ▶ | for(my $i=0; $i< $nodeStack->count(); $i++) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 73 | 120 | my $node = $nodeStack->get($i); | |||||||||||||||||||||||||||||||||||
| 74 | 120 | my $name = undef; | |||||||||||||||||||||||||||||||||||
| 75 | 120 | ▶ | if (UNIVERSAL::can ($node, "nameIsAutoGenerated") && $node->nameIsAutoGenerated() ) { | ||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition66%2/3
UNIVERSAL::can($node, "nameIsAutoGenerated") and $node->nameIsAutoGenerated
MC/DC50%1/2
UNIVERSAL::can($node, "nameIsAutoGenerated") and $node->nameIsAutoGenerated
UNIVERSAL::can($node, "nameIsAutoGenerated")
$node->nameIsAutoGenerated
Truth table66%2/3
A and B
A= UNIVERSAL::can($node, "nameIsAutoGenerated")B= $node->nameIsAutoGenerated
| |||||||||||||||||||||||||||||||||||||
| 76 | # ignore auto-generated names | ||||||||||||||||||||||||||||||||||||
| 77 | 11 | $name = undef; | |||||||||||||||||||||||||||||||||||
| 78 | }elsif (UNIVERSAL::can ($node, "name")) { | ||||||||||||||||||||||||||||||||||||
| 79 | 109 | $name = $node->name(); | |||||||||||||||||||||||||||||||||||
| 80 | ▶ | }elsif ((ref($node) =~ /HASH/) && $node->{name}) { | |||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref($node) =~ /HASH/ and $node->{"name"}
MC/DC0%0/2
ref($node) =~ /HASH/ and $node->{"name"}
ref($node) =~ /HASH/
$node->{"name"}
Truth table0%0/3
A and B
A= ref($node) =~ /HASH/B= $node->{"name"}
| |||||||||||||||||||||||||||||||||||||
| 81 | 0 | $name = $node->{name}; | |||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||
| 84 | 120 | ▶ | if ($name) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 85 | 48 | unshift @names,$name; | |||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||
| 88 | 33 | return join $separator, @names; | |||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||
| 92 | 10 | 1; | |||||||||||||||||||||||||||||||||||