« blib/lib/PMLTQ/Relation/TreexFilelistIterator.pm
↑ Summary
blib/lib/PMLTQ/Relation/CurrentFilelistTreesIterator.pm »
| 1 | package PMLTQ::Relation::PMLREFIterator; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 12 | our $AUTHORITY = 'cpan:MATY'; | |||||||||||||||||||||||||||||||||||||||||
| 3 | 12 | $PMLTQ::Relation::PMLREFIterator::VERSION = '1.5.0'; | |||||||||||||||||||||||||||||||||||||||||
| 4 | # ABSTRACT: Iterates over PML reference | ||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 12 | ▶ | use 5.006; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 12 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 12 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 12 | ▶ | use base qw(PMLTQ::Relation::SimpleListIterator); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 12 | ▶ | use constant ATTR => PMLTQ::Relation::SimpleListIterator::FIRST_FREE; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 12 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 12 | my $can_open_secondary = exists(&TredMacro::OpenSecondaryFiles); | |||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | sub new { | ||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | ▶ | my ($class,$conditions,$attr)=@_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | ▶ | croak "usage: $class->new(sub{...},\$attr)" unless (ref($conditions) eq 'CODE' and defined $attr); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $conditions eq "CODE" and defined $attr
MC/DC0%0/2
ref $conditions eq "CODE" and defined $attr
ref $conditions eq "CODE"
defined $attr
Truth table0%0/3
A and B
A= ref $conditions eq "CODE"B= defined $attr
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | my $self = PMLTQ::Relation::SimpleListIterator->new($conditions); | |||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | $self->[ATTR]=$attr; | |||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | bless $self, $class; # reblessing | |||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||||||||||||
| 24 | sub clone { | ||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | ▶ | my ($self)=@_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | my $clone = $self->PMLTQ::Relation::SimpleListIterator::clone(); | |||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | $clone->[ATTR]=$self->[ATTR]; | |||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | return $clone; | |||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||
| 30 | sub get_node_list { | ||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | my ($self,$node)=@_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_node_list: not called CC=13 SCAR=52.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | my $fsfile = $self->[PMLTQ::Relation::SimpleListIterator::FILE]; | |||||||||||||||||||||||||||||||||||||||||
| 33 | return [map { | ||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | my $id = $_; | |||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | if ($id=~s{^(.*)?#}{} and defined($1) and length($1)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$id =~ s/^(.*)?#// and defined $1 and length $1
$id =~ s/^(.*)?#// and defined $1
MC/DC0%0/3
$id =~ s/^(.*)?#// and defined $1 and length $1
$id =~ s/^(.*)?#//
defined $1
length $1
Truth table0%0/4
A and B and C
A= $id =~ s/^(.*)?#//B= defined $1C= length $1
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | unless (ref $fsfile) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | Carp::confess("No fsfile!"); | |||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | my $refs = $fsfile->appData('ref'); | |||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | my $ref_fs = $refs && $refs->{$1}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$refs && $refs->{$1}
MC/DC0%0/2
$refs && $refs->{$1}
$refs
$refs->{$1}
Truth table0%0/3
A && B
A= $refsB= $refs->{$1}
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | if (!$ref_fs and $can_open_secondary) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $ref_fs and $can_open_secondary
MC/DC0%0/2
not $ref_fs and $can_open_secondary
not $ref_fs
$can_open_secondary
Truth table0%0/3
not(A) and B
A= not $ref_fsB= $can_open_secondary
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | TredMacro::OpenSecondaryFiles($fsfile); | |||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | $refs = $fsfile->appData('ref'); | |||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | $ref_fs = $refs && $refs->{$1}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$refs && $refs->{$1}
MC/DC0%0/2
$refs && $refs->{$1}
$refs
$refs->{$1}
Truth table0%0/3
A && B
A= $refsB= $refs->{$1}
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | my $n = $ref_fs && PML::GetNodeByID($id,$ref_fs); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$ref_fs && PML::GetNodeByID($id, $ref_fs)
MC/DC0%0/2
$ref_fs && PML::GetNodeByID($id, $ref_fs)
$ref_fs
PML::GetNodeByID($id, $ref_fs)
Truth table0%0/3
A && B
A= $ref_fsB= PML::GetNodeByID($id, $ref_fs)
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | $ref_fs && $n ? [$n, $ref_fs] : (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$ref_fs and $n
MC/DC0%0/2
$ref_fs and $n
$ref_fs
$n
Truth table0%0/3
A and B
A= $ref_fsB= $n
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | my $n = PML::GetNodeByID($id,$fsfile); | |||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | $n ? [$n, $fsfile] : () | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | } grep { defined } Treex::PML::Instance::get_all($node,$self->[ATTR])]; | |||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 12 | 1; # End of PMLTQ::Relation::PMLREFIterator | |||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | __END__ | ||||||||||||||||||||||||||||||||||||||||||