| 1 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # Revision: $Id: Treex::PML.pm 3044 2007-06-08 17:47:08Z pajas $ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # See the bottom of this file for the POD documentation. Search for the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # string '=head'. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # Authors: Petr Pajas, Jan Stepanek | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # E-mail: tred@ufal.mff.cuni.cz | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # Description: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # Several Perl Routines to handle files in treebank FS format | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # See complete help in POD format at the end of this file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | package Treex::PML; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 9 | ▶ | use vars qw(@EXPORT @EXPORT_OK @ISA $VERSION $API_VERSION %COMPATIBLE_API_VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 9 | $FSError $Debug $resourcePath $resourcePathSplit @BACKENDS); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 9 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 9 | $VERSION = "2.29"; # change when new functions are added etc | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 9 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 9 | ▶ | use Scalar::Util qw(weaken blessed); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 9 | ▶ | use Storable qw(dclone); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 9 | ▶ | use Treex::PML::Document; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 9 | ▶ | use Treex::PML::Factory; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 9 | ▶ | use Treex::PML::StandardFactory; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 9 | ▶ | use Treex::PML::Resource::URI; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 9 | ▶ | BEGIN { Treex::PML::StandardFactory->make_default() } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 9 | ▶ | use Treex::PML::IO; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 9 | ▶ | use UNIVERSAL::DOES qw(does); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 9 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 9 | ▶ | use Treex::PML::Node; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 9 | ▶ | use Exporter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 9 | ▶ | use File::Spec; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 9 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 9 | ▶ | use URI; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 9 | ▶ | use URI::file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 9 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 9 | @ISA=qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 9 | $API_VERSION = "2.0"; # change when internal data structures change, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | # in a way that may prevent old binary dumps to work properly | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 9 | %COMPATIBLE_API_VERSION = map { $_ => 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | qw( 1.1 1.2 ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | $API_VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 9 | @EXPORT = qw/&ImportBackends/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 9 | @EXPORT_OK = qw/&Next &Prev &Cut &DeleteLeaf $FSError &Index &SetParent &SetLBrother &SetRBrother &SetFirstSon &Paste &Parent &LBrother &RBrother &FirstSon ResourcePaths FindInResources FindInResourcePaths FindDirInResources FindDirInResourcePaths ResolvePath &CloneValue AddResourcePath AddResourcePathAsFirst SetResourcePaths RemoveResourcePath UseBackends AddBackends Backends /; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 9 | ▶ | $Debug=$ENV{TREEX_PML_DEBUG}||0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$ENV{'TREEX_PML_DEBUG'} || 0
MC/DC0%0/1
$ENV{'TREEX_PML_DEBUG'} || 0
$ENV{'TREEX_PML_DEBUG'}
Truth table50%1/2
A
A= $ENV{'TREEX_PML_DEBUG'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 9 | *DEBUG = \$Debug; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 9 | ▶ | $resourcePathSplit = ($^O eq "MSWin32") ? ',' : ':'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 9 | $FSError=0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 9 | ImportBackends('FS'); # load FS | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 9 | UseBackends('PML'); # default will be PML | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | sub Root { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Root: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | my ($node) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | return ref($node) && $node->root; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $node && $node->root
MC/DC0%0/2
ref $node && $node->root
ref $node
$node->root
Truth table0%0/3
A && B
A= ref $nodeB= $node->root
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | ▶ | sub Parent { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Parent: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | my ($node) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | ▶ | return ref($node) && $node->parent; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $node && $node->parent
MC/DC0%0/2
ref $node && $node->parent
ref $node
$node->parent
Truth table0%0/3
A && B
A= ref $nodeB= $node->parent
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | sub LBrother ($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
LBrother: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | my ($node) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | return ref($node) && $node->lbrother; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $node && $node->lbrother
MC/DC0%0/2
ref $node && $node->lbrother
ref $node
$node->lbrother
Truth table0%0/3
A && B
A= ref $nodeB= $node->lbrother
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | sub RBrother ($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
RBrother: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | my ($node) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | return ref($node) && $node->rbrother; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $node && $node->rbrother
MC/DC0%0/2
ref $node && $node->rbrother
ref $node
$node->rbrother
Truth table0%0/3
A && B
A= ref $nodeB= $node->rbrother
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | sub FirstSon ($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FirstSon: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | my ($node) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | return ref($node) && $node->firstson; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $node && $node->firstson
MC/DC0%0/2
ref $node && $node->firstson
ref $node
$node->firstson
Truth table0%0/3
A && B
A= ref $nodeB= $node->firstson
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | sub SetParent ($$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
SetParent: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | my ($node,$parent) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | return ref($node) && $node->set_parent($parent); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $node && $node->set_parent($parent)
MC/DC0%0/2
ref $node && $node->set_parent($parent)
ref $node
$node->set_parent($parent)
Truth table0%0/3
A && B
A= ref $nodeB= $node->set_parent($parent)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | sub SetLBrother ($$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
SetLBrother: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | my ($node,$brother) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | return ref($node) && $node->set_lbrother($brother); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $node && $node->set_lbrother($brother)
MC/DC0%0/2
ref $node && $node->set_lbrother($brother)
ref $node
$node->set_lbrother($brother)
Truth table0%0/3
A && B
A= ref $nodeB= $node->set_lbrother($brother)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | sub SetRBrother ($$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
SetRBrother: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | my ($node,$brother) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | return ref($node) && $node->set_rbrother($brother); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $node && $node->set_rbrother($brother)
MC/DC0%0/2
ref $node && $node->set_rbrother($brother)
ref $node
$node->set_rbrother($brother)
Truth table0%0/3
A && B
A= ref $nodeB= $node->set_rbrother($brother)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | sub SetFirstSon ($$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
SetFirstSon: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | my ($node,$son) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | ▶ | return ref($node) && $node->set_firstson($son); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $node && $node->set_firstson($son)
MC/DC0%0/2
ref $node && $node->set_firstson($son)
ref $node
$node->set_firstson($son)
Truth table0%0/3
A && B
A= ref $nodeB= $node->set_firstson($son)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | sub Next { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Next: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | my ($node,$top) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | return ref($node) && $node->following($top); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $node && $node->following($top)
MC/DC0%0/2
ref $node && $node->following($top)
ref $node
$node->following($top)
Truth table0%0/3
A && B
A= ref $nodeB= $node->following($top)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | ▶ | sub Prev { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Prev: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | my ($node,$top) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | ▶ | return ref($node) && $node->previous($top); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $node && $node->previous($top)
MC/DC0%0/2
ref $node && $node->previous($top)
ref $node
$node->previous($top)
Truth table0%0/3
A && B
A= ref $nodeB= $node->previous($top)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | ▶ | sub Cut ($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Cut: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | my ($node)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | return ref($node) && $node->cut; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $node && $node->cut
MC/DC0%0/2
ref $node && $node->cut
ref $node
$node->cut
Truth table0%0/3
A && B
A= ref $nodeB= $node->cut
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | sub Paste ($$$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Paste: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | my $node = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | return $node->paste_on(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | sub PasteAfter ($$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
PasteAfter: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | my $node = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | return $node->paste_after(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | sub PasteBefore ($$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
PasteBefore: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | my $node = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | return $node->paste_before(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | sub _WeakenLinks { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_WeakenLinks: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | my ($node)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | while ($node) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | $node->_weakenLinks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $node = $node->following(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | sub DeleteTree ($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DeleteTree: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | my ($top)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | return $top->destroy(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | sub DeleteLeaf ($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DeleteLeaf: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | my ($node) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | return $node->destroy_leaf(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 82 | ▶ | sub CloneValue { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CloneValue: called CC=8 SCAR=22.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 82 | my ($what,$old,$new)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 82 | ▶ | if (ref $what) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 82 | my $val; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 82 | ▶ | if (defined $old) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 82 | ▶ | $new = $old unless defined $new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | # work around a bug in Data::Dumper: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 82 | ▶ | if (UNIVERSAL::can('Data::Dumper','init_refaddr_format')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | Data::Dumper::init_refaddr_format(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | # Sometimes occurs, that $new->[1] is undef. This bug appeared randomly, due to reimplimentation of hash in perl5.18 (http://perldoc.perl.org/perldelta.html#Hash-overhaul. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | # In previous versions it did not appear, thanks to hash order "new->[1]" < "new->[0]" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | my $dump=Data::Dumper->new([$what], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | ['val']) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 82 | ▶ | ->Seen({map { (ref($old->[$_]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $old->[$_] and defined $new->[$_]
MC/DC50%1/2
ref $old->[$_] and defined $new->[$_]
ref $old->[$_]
defined $new->[$_]
Truth table66%2/3
A and B
A= ref $old->[$_]B= defined $new->[$_]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | and defined($new->[$_]) # bugfix | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | )? (qq{new->[$_]} => $old->[$_]) : () } 0..$#$old}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | ->Purity(1)->Indent(0)->Dump; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 82 | eval $dump; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 82 | ▶ | die $@ if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | # return Scalar::Util::Clone::clone($what); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | return dclone($what); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | # eval Data::Dumper->new([$what],['val'])->Indent(0)->Purity(1)->Dump; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | # die $@ if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 82 | return $val; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | return $what; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | sub Index ($$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Index: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | my ($ar,$i) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | for (my $n=0;$n<=$#$ar;$n++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | return $n if ($ar->[$n] eq $i); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 333 | ▶ | sub _is_url { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_url: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 333 | ▶ | return ($_[0] =~ m(^\s*[[:alnum:]]+://)) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 173 | ▶ | sub _is_updir { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_updir: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 173 | my $uri = Treex::PML::IO::make_URI($_[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 173 | ▶ | return ($uri->path =~ m{(/|^)\.\.($|/)} ? 1 : 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 215 | ▶ | sub _is_absolute { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_absolute: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 215 | my ($path) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 215 | ▶ | return (_is_url($path) or File::Spec->file_name_is_absolute($path)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
_is_url($path) || 'File::Spec'->file_name_is_absolute($path)
MC/DC100%2/2
_is_url($path) || 'File::Spec'->file_name_is_absolute($path)
_is_url($path)
'File::Spec'->file_name_is_absolute($path)
Truth table100%3/3
A || B
A= _is_url($path)B= 'File::Spec'->file_name_is_absolute($path)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | sub FindDirInResources { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FindDirInResources: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | my ($filename)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | unless (_is_absolute($filename) or _is_updir($filename)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
_is_absolute($filename) or _is_updir($filename)
MC/DC0%0/2
_is_absolute($filename) or _is_updir($filename)
_is_absolute($filename)
_is_updir($filename)
Truth table0%0/3
A or B
A= _is_absolute($filename)B= _is_updir($filename)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | for my $dir (ResourcePaths()) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | my $f = File::Spec->catfile($dir,$filename); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | ▶ | return $f if -d $f; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | return $filename; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 9 | ▶ | BEGIN{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 9 | *FindDirInResourcePaths = \&FindDirInResources; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 92 | ▶ | sub FindInResources { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FindInResources: called CC=10 SCAR=23.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 92 | my ($filename,$opts)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 92 | ▶ | my $all = ref($opts) && $opts->{all}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
ref $opts && $opts->{'all'}
MC/DC100%2/2
ref $opts && $opts->{'all'}
ref $opts
$opts->{'all'}
Truth table100%3/3
A && B
A= ref $optsB= $opts->{'all'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 92 | my @matches; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 92 | ▶ | unless (_is_absolute($filename) or _is_updir($filename)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
_is_absolute($filename) or _is_updir($filename)
MC/DC50%1/2
_is_absolute($filename) or _is_updir($filename)
_is_absolute($filename)
_is_updir($filename)
Truth table66%2/3
A or B
A= _is_absolute($filename)B= _is_updir($filename)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 55 | for my $dir (ResourcePaths()) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 55 | my $f = File::Spec->catfile($dir,$filename); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 55 | ▶ | if (-f $f) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 27 | ▶ | return $f unless $all; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | push @matches,$f; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 65 | ▶ | return ($all or (ref($opts) && $opts->{strict})) ? @matches : $filename; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$all or ref $opts and $opts->{"strict"}
ref $opts and $opts->{"strict"}
MC/DC66%2/3
$all or ref $opts and $opts->{"strict"}
$all
ref $opts
$opts->{"strict"}
Truth table75%3/4
A or B and C
A= $allB= ref $optsC= $opts->{"strict"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 9 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 9 | *FindInResourcePaths = \&FindInResources; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 64 | ▶ | sub ResourcePaths { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ResourcePaths: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 64 | ▶ | return unless defined $resourcePath; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 55 | ▶ | return wantarray ? split(/\Q${resourcePathSplit}\E/, $resourcePath) : $resourcePath; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 9 | ▶ | BEGIN { *ResourcePath = \&ResourcePaths; } # old name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 11 | ▶ | sub AddResourcePath { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
AddResourcePath: called CC=3 SCAR=12.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 11 | ▶ | if (defined($resourcePath) and length($resourcePath)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $Treex::PML::resourcePath and length $Treex::PML::resourcePath
MC/DC0%0/2
defined $Treex::PML::resourcePath and length $Treex::PML::resourcePath
defined $Treex::PML::resourcePath
length $Treex::PML::resourcePath
Truth table66%2/3
A and B
A= defined $Treex::PML::resourcePathB= length $Treex::PML::resourcePath
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | $resourcePath.=$resourcePathSplit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 11 | $resourcePath .= join $resourcePathSplit,@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | sub AddResourcePathAsFirst { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
AddResourcePathAsFirst: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | ▶ | $resourcePath = join($resourcePathSplit,@_) . (($resourcePath ne q{}) ? ($resourcePathSplit.$resourcePath) : q{}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | ▶ | sub RemoveResourcePath { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
RemoveResourcePath: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | my %remove; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | @remove{@_} = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | ▶ | return unless defined $resourcePath; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | $resourcePath = join $resourcePathSplit, grep { !exists($remove{$_}) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | split /\Q$resourcePathSplit\E/, $resourcePath; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 9 | ▶ | sub SetResourcePaths { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
SetResourcePaths: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 9 | $resourcePath=join $resourcePathSplit,@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 117 | ▶ | sub _is_local { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_local: called CC=6 SCAR=24.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 117 | my ($url) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 117 | ▶ | return (((blessed($url) && $url->isa('URI') && (($url->scheme||'file') eq 'file')) or $url =~ m{^file:/}) ? 1 : 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition36%4/11
builtin::blessed($url) and $url->isa("URI") and ($url->scheme || "file") eq "file" or $url =~ m[^file:/]
builtin::blessed($url) and $url->isa("URI") and ($url->scheme || "file") eq "file"
builtin::blessed($url) and $url->isa("URI")
$url->scheme || 'file'
MC/DC0%0/4
builtin::blessed($url) and $url->isa("URI") and ($url->scheme || "file") eq "file" or $url =~ m[^file:/]
builtin::blessed($url)
$url->isa("URI")
$url->scheme
$url =~ m[^file:/]
Truth table14%1/7
A and B and C or D
A= builtin::blessed($url)B= $url->isa("URI")C= $url->schemeD= $url =~ m[^file:/]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | sub _strip_file_prefix { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_strip_file_prefix: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | my $url = $_[0]; # ARGUMENT WILL GET MODIFIED | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | ▶ | if (_is_local($url)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | $_[0] = Treex::PML::IO::get_filename($url); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 123 | ▶ | sub ResolvePath ($$;$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ResolvePath: called CC=17 SCAR=31.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 123 | my ($base, $href,$use_resources)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 123 | my $rel_uri = Treex::PML::IO::make_URI($href); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 123 | my $base_uri = Treex::PML::IO::make_abs_URI($base); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 123 | ▶ | print STDERR "ResolvePath: rel='$rel_uri', base='$base_uri'\n" if $Treex::PML::Debug; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 123 | my $abs_uri = $rel_uri->abs($base_uri); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 123 | ▶ | if (_is_absolute($rel_uri)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 5 | return $rel_uri; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | } elsif (_is_updir($rel_uri)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 3 | ▶ | return _is_url($base) ? $abs_uri : Treex::PML::IO::get_filename($abs_uri); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 115 | my $abs_f = Treex::PML::IO::get_filename($abs_uri); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 115 | my $rel_f = Treex::PML::IO::get_filename($rel_uri); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 115 | ▶ | if (_is_local($base_uri)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 115 | ▶ | if (-f $abs_f) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 86 | ▶ | print STDERR "\t=> (LocalURL-relative) result='$abs_f'\n" if $Treex::PML::Debug; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 86 | ▶ | return _is_url($base) ? $abs_uri : $abs_f; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | } elsif ( not _is_url($base) ) { # base was a filename: try path relative to cwd | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | ▶ | print STDERR "\t=> (cwd-relative) result='$rel_f'\n" if $Treex::PML::Debug; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | ▶ | return $rel_f if -f $rel_f; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 29 | ▶ | if ($use_resources) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 27 | my ($res) = FindInResources($rel_f,{strict=>1}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 27 | ▶ | if ($res) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 27 | ▶ | print STDERR "\t=> (resources) result='$res'\n" if $Treex::PML::Debug; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 27 | return Treex::PML::Resource::URI->new($res) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 2 | ▶ | print STDERR "\t=> (relative) result='$abs_uri'\n" if $Treex::PML::Debug; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | # The following line has been changed. The resources are handled | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | # lazily, i.e. relative URL is returned on not found files to be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | # searched in resources later. Original line: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | # return _is_url($base) ? $abs_uri : $abs_f; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 2 | ▶ | return _is_local($base) ? $rel_uri : $abs_uri; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 20 | ▶ | sub ImportBackends { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ImportBackends: called CC=8 SCAR=23.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 20 | my @backends=(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 20 | foreach my $backend (@_) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 20 | ▶ | print STDERR "LOADING $backend\n" if $Treex::PML::Debug; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 20 | my $b; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 20 | for my $try (_BackendCandidates($backend)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 20 | my $file = $try.'.pm'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 20 | $file=~s{::}{/}g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 20 | ▶ | if (eval { require $file; } or $::INC{$file}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
eval {
do {
require $file
}
} or $INC{$file}
MC/DC0%0/2
eval {
do {
require $file
}
} or $INC{$file}
eval {
do {
require $file
}
}
$INC{$file}
Truth table33%1/3
A or B
A= eval {
do {
require $file
}
}B= $INC{$file}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 20 | $b=$backend; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 20 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 20 | ▶ | if ($b) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 20 | push @backends,$b; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | ▶ | warn $@ if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | warn "FAILED TO LOAD $backend\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 20 | return @backends; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 11 | ▶ | sub UseBackends { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
UseBackends: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 11 | @BACKENDS = ImportBackends(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 11 | ▶ | return wantarray ? @BACKENDS : ((@_==@BACKENDS) ? 1 : 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | ▶ | sub Backends { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Backends: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | return @BACKENDS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | ▶ | sub AddBackends { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
AddBackends: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | my %have; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | @have{ @BACKENDS } = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | my @new = grep !exists($have{$_}), @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | my @imported = ImportBackends(@new); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | push @BACKENDS, @imported; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | $have{ @BACKENDS } = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | ▶ | return wantarray ? (grep exists($have{$_}), @_) : ((@new==@imported) ? 1 : 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 55 | ▶ | sub _BackendCandidates { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_BackendCandidates: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 55 | my ($backend)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 55 | ▶ | ($backend=~/:/ ? ($backend) : ()), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | ($backend=~/^([^:]+)Backend$/ ? ('Treex::PML::Backend::'.$1) : ()), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | ($backend=~/^Treex::PML::Backend::/ ? () : 'Treex::PML::Backend::'.$backend), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | ($backend=~/:/ ? () : ($backend)), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 24 | ▶ | sub BackendCanRead { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BackendCanRead: called CC=6 SCAR=20.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 24 | my ($backend)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 24 | my $b; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 24 | for my $try (_BackendCandidates($backend)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 24 | ▶ | if (UNIVERSAL::can($try,'open_backend')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 24 | $b = $try; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 24 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 24 | ▶ | return $b if ($b and UNIVERSAL::can($b,'test') and UNIVERSAL::can($b,'read')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$b and UNIVERSAL::can($b, "test") and UNIVERSAL::can($b, "read")
$b and UNIVERSAL::can($b, "test")
MC/DC0%0/3
$b and UNIVERSAL::can($b, "test") and UNIVERSAL::can($b, "read")
$b
UNIVERSAL::can($b, "test")
UNIVERSAL::can($b, "read")
Truth table25%1/4
A and B and C
A= $bB= UNIVERSAL::can($b, "test")C= UNIVERSAL::can($b, "read")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 11 | ▶ | sub BackendCanWrite { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BackendCanWrite: called CC=5 SCAR=17.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 11 | my ($backend)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 11 | my $b; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 11 | for my $try (_BackendCandidates($backend)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 11 | ▶ | if (UNIVERSAL::can($try,'open_backend')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 11 | $b = $try; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 11 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 11 | ▶ | return $b if ($b and UNIVERSAL::can($b,'write')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$b and UNIVERSAL::can($b, "write")
MC/DC0%0/2
$b and UNIVERSAL::can($b, "write")
$b
UNIVERSAL::can($b, "write")
Truth table33%1/3
A and B
A= $bB= UNIVERSAL::can($b, "write")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 9 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||