| 1 | package XML::Directory; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | require 5.005_03; | |||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | BEGIN { require warnings if $] >= 5.006; } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use vars qw(@ISA @EXPORT_OK $VERSION); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use File::Spec::Functions (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use DirHandle; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use Cwd; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | require Exporter; | |||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | @EXPORT_OK = qw(get_dir); | |||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | $VERSION = '1.00'; | |||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | ###################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 20 | # object interface | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 2 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=16.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 2 | my ($class, $path, $details, $depth) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 24 | 2 | ▶ | $path = cwd unless @_ > 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 2 | ▶ | $details = 2 unless @_ > 2; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | 2 | ▶ | $depth = 1000 unless @_ > 3; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | 2 | ▶ | $path = cwd if $path eq '.'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | 2 | my $self = { | |||||||||||||||||||||||||||||||||||||||||
| 31 | path => File::Spec::Functions::canonpath($path), | ||||||||||||||||||||||||||||||||||||||||||
| 32 | details => $details, | ||||||||||||||||||||||||||||||||||||||||||
| 33 | depth => $depth, | ||||||||||||||||||||||||||||||||||||||||||
| 34 | error => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 35 | catch_error => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 36 | ns_enabled => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 37 | doctype => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 38 | rdf_enabled => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 39 | n3_index => '', | ||||||||||||||||||||||||||||||||||||||||||
| 40 | ns_uri => 'http://gingerall.org/directory/1.0/', | ||||||||||||||||||||||||||||||||||||||||||
| 41 | ns_prefix => 'xd', | ||||||||||||||||||||||||||||||||||||||||||
| 42 | encoding => 'utf-8', | ||||||||||||||||||||||||||||||||||||||||||
| 43 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 2 | bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||
| 45 | 2 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | 1 | ▶ | sub parse { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse: called CC=10 SCAR=31.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | 1 | ▶ | if ($self->{details} !~ /^[123]$/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | $self->doError(1,$self->{details}) | ||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | } | |||||||||||||||||||||||||||||||||||||||||
| 54 | 1 | ▶ | if ($self->{depth} !~ /^\d+$/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | $self->doError(2,$self->{depth}) | ||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | } | |||||||||||||||||||||||||||||||||||||||||
| 57 | 1 | ▶ | if ($self->{error} == 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | 1 | $self->{seq} = 1; # a sequence used for doc:Position | |||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | 1 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 62 | 1 | ▶ | chdir ($self->{path}) or die "Path $self->{path} not found!\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | # turning relative paths to absolute ones | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 1 | $self->{path} = cwd; | |||||||||||||||||||||||||||||||||||||||||
| 65 | 1 | my @dirs = File::Spec::Functions::splitdir($self->{path}); | |||||||||||||||||||||||||||||||||||||||||
| 66 | 1 | my $dirname = pop @dirs; | |||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | 1 | $self->doStartDocument; | |||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | 1 | ▶ | if ($self->{ns_enabled}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | my @attr = (); | |||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | my $decl = $self->_ns_declaration; | |||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | push @attr, [$decl => $self->{ns_uri}]; | |||||||||||||||||||||||||||||||||||||||||
| 74 | push @attr, ['xmlns:doc' => | ||||||||||||||||||||||||||||||||||||||||||
| 75 | 'http://gingerall.org/charlie-doc/1.0/'] | ||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | if $self->{rdf_enabled}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | $self->doStartElement('dirtree', \@attr); | |||||||||||||||||||||||||||||||||||||||||
| 78 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 79 | 1 | $self->doStartElement('dirtree', undef); | |||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | 1 | ▶ | if ($self->{details} > 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | my @attr = (); | |||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | push @attr, [version => $XML::Directory::VERSION]; | |||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | $self->doStartElement('head', \@attr); | |||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | $self->doElement('path', undef, $self->{path}); | |||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | $self->doElement('details', undef, $self->{details}); | |||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | $self->doElement('depth', undef, $self->{depth}); | |||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | $self->doElement('orderby', [[code=>$self->order_by()]], undef); | |||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | $self->doEndElement('head'); | |||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | 1 | my $rc = $self->_directory('', $dirname, 0); | |||||||||||||||||||||||||||||||||||||||||
| 95 | 1 | ▶ | return 0 if $rc == -1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | 1 | $self->doEndElement('dirtree'); | |||||||||||||||||||||||||||||||||||||||||
| 98 | 1 | $self->doEndDocument; | |||||||||||||||||||||||||||||||||||||||||
| 99 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 100 | 1 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | chomp $@; | |||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | $self->doError(3,$@); | |||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | sub set_path { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_path: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | my ($self, $path) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | $path = cwd unless @_ > 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | $self->{path} = File::Spec::Functions::canonpath($path),; | |||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | sub set_details { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_details: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | my ($self, $details) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | ▶ | $details = 2 unless @_ > 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | $self->{details} = $details; | |||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | sub set_maxdepth { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_maxdepth: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | my ($self, $depth) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | $depth = 1000 unless @_ > 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | $self->{depth} = $depth; | |||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | ▶ | sub get_path { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_path: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | return $self->{path}; | |||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | sub get_details { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_details: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | return $self->{details}; | |||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | 1 | ▶ | sub get_maxdepth { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_maxdepth: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 136 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 137 | 1 | return $self->{depth}; | |||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | sub enable_ns { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
enable_ns: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | $self->{ns_enabled} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | sub disable_ns { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
disable_ns: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | $self->{ns_enabled} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | sub enable_doctype { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
enable_doctype: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $self->{doctype} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | sub disable_doctype { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
disable_doctype: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | $self->{doctype} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | ▶ | sub get_ns_data { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_ns_data: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 162 | return { | ||||||||||||||||||||||||||||||||||||||||||
| 163 | ns_enabled => $self->{ns_enabled}, | ||||||||||||||||||||||||||||||||||||||||||
| 164 | ns_uri => $self->{ns_uri}, | ||||||||||||||||||||||||||||||||||||||||||
| 165 | ns_prefix => $self->{ns_prefix}, | ||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | sub encoding { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
encoding: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | my ($self, $code) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | if (@_ > 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | $self->{encoding} = $code; | |||||||||||||||||||||||||||||||||||||||||
| 173 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | return $self->{encoding}; | |||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | ▶ | sub error_treatment { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
error_treatment: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | my ($self, $val) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | ▶ | if (@_ > 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | ▶ | $self->{catch_error} = 0 if $val eq 'die'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | $self->{catch_error} = 1 if $val eq 'warn'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 183 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | ▶ | return 'die' if $self->{catch_error} == 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | return 'warn' if $self->{catch_error} == 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | sub enable_rdf { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
enable_rdf: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | my ($self, $index) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | $self->{ns_enabled} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | $self->{rdf_enabled} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | $self->{n3_index} = $index; | |||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | eval { require RDF::Notation3; }; | |||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | chomp $@; | |||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | $self->doError(5,$@) if $@; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | sub disable_rdf { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
disable_rdf: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | $self->{rdf_enabled} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | 3 | ▶ | sub order_by { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
order_by: called CC=3 SCAR=12.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 205 | 3 | my ($self, $code) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | 3 | ▶ | if (defined($code)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | $self->{'__orderby'} = $code; | |||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||
| 212 | 3 | ▶ | return $self->{'__orderby'} || "df"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{'__orderby'} || 'df'
MC/DC0%0/1
$self->{'__orderby'} || 'df'
$self->{'__orderby'}
Truth table50%1/2
A
A= $self->{'__orderby'}
| |||||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | ###################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 216 | # original interface | ||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||
| 218 | 1 | ▶ | sub get_dir { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_dir: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | 1 | require XML::Directory::String; | |||||||||||||||||||||||||||||||||||||||||
| 221 | 1 | my $h = XML::Directory::String->new(@_); | |||||||||||||||||||||||||||||||||||||||||
| 222 | 1 | $h->parse_dir; | |||||||||||||||||||||||||||||||||||||||||
| 223 | 1 | return @{$h->{xml}}; | |||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||
| 226 | ###################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 227 | # private procedures | ||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | 1 | ▶ | sub _directory { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_directory: called CC=52 SCAR=73.3
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | 1 | my ($self, $path, $dirname, $level, $rdf_data_P, $rdf_P) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | # rdf metadata | ||||||||||||||||||||||||||||||||||||||||||
| 233 | 1 | my $rdf_data = 0; # RDF/N3 meta-data found or not | |||||||||||||||||||||||||||||||||||||||||
| 234 | 1 | my $doc_prefix = 'doc'; # default prefix | |||||||||||||||||||||||||||||||||||||||||
| 235 | 1 | my $rdf; # rdf object | |||||||||||||||||||||||||||||||||||||||||
| 236 | 1 | my $stop = 0; # end of recursion controlled by meta-data | |||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||
| 238 | 1 | ▶ | if ($self->{rdf_enabled}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | if (-f $self->{n3_index}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | require RDF::Notation3::PrefTriples; | |||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | $rdf = RDF::Notation3::PrefTriples->new(); | |||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | eval {_try_to_parse($rdf, $self->{n3_index})}; | |||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | $self->doError(6,"$dirname, $@"); | |||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | return -1; | |||||||||||||||||||||||||||||||||||||||||
| 247 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | $rdf_data = 1; | |||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||
| 251 | # parent N3 is read for uppermost directories only | ||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | ▶ | if (not $rdf_data_P) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 253 | # link-safe way to get a parent dir | ||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | my $p_n3 = $self->{path} . $path; | |||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | $p_n3 =~ s/[^\/\\]+$/$self->{n3_index}/; | |||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | $p_n3 = File::Spec::Functions::canonpath($p_n3); | |||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | ▶ | if (-f $p_n3) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | require RDF::Notation3::PrefTriples; | |||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | $rdf_P = RDF::Notation3::PrefTriples->new(); | |||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | eval {$rdf_P->parse_file($p_n3)}; | |||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | $self->doError(6,"$dirname, $@"); | |||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | return -1; | |||||||||||||||||||||||||||||||||||||||||
| 265 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | $rdf_data_P = 1; | |||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | 1 | my @stat = stat '.'; | |||||||||||||||||||||||||||||||||||||||||
| 273 | 1 | $dirname =~ s/&/&/; | |||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||
| 275 | 1 | my @attr = ([name => $dirname]); | |||||||||||||||||||||||||||||||||||||||||
| 276 | 1 | ▶ | push @attr, ['depth', $level] if $self->{details} > 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 277 | 1 | ▶ | push @attr, ['uid', $stat[4]] if $self->{details} > 2; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 278 | 1 | ▶ | push @attr, ['gid', $stat[5]] if $self->{details} > 2; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | # rdf metadata NS | ||||||||||||||||||||||||||||||||||||||||||
| 281 | 1 | ▶ | if ($rdf_data) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | foreach (keys %{$rdf->{ns}->{$rdf->{context}}}) { | |||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | ▶ | if ($rdf->{ns}->{$rdf->{context}}->{$_} eq | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 284 | 'http://gingerall.org/charlie-doc/1.0/') { | ||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | $doc_prefix = $_; | |||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||
| 287 | push @attr, | ||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | ["xmlns:$_" => $rdf->{ns}->{$rdf->{context}}->{$_}]; | |||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||
| 291 | 1 | ▶ | if ($rdf_data_P) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | foreach (keys %{$rdf_P->{ns}->{$rdf_P->{context}}}) { | |||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | ▶ | unless ($rdf_data and $rdf->{ns}->{$rdf->{context}}->{$_} and | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$rdf_data and $rdf->{"ns"}{$rdf->{"context"}}{$_} and $rdf->{"ns"}{$rdf->{"context"}}{$_} eq $rdf_P->{"ns"}{$rdf_P->{"context"}}{$_}
$rdf_data and $rdf->{"ns"}{$rdf->{"context"}}{$_}
MC/DC0%0/3
$rdf_data and $rdf->{"ns"}{$rdf->{"context"}}{$_} and $rdf->{"ns"}{$rdf->{"context"}}{$_} eq $rdf_P->{"ns"}{$rdf_P->{"context"}}{$_}
$rdf_data
$rdf->{"ns"}{$rdf->{"context"}}{$_}
$rdf->{"ns"}{$rdf->{"context"}}{$_} eq $rdf_P->{"ns"}{$rdf_P->{"context"}}{$_}
Truth table0%0/4
A and B and C
A= $rdf_dataB= $rdf->{"ns"}{$rdf->{"context"}}{$_}C= $rdf->{"ns"}{$rdf->{"context"}}{$_} eq $rdf_P->{"ns"}{$rdf_P->{"context"}}{$_}
| |||||||||||||||||||||||||||||||||||||||||||
| 295 | $rdf->{ns}->{$rdf->{context}}->{$_} eq | ||||||||||||||||||||||||||||||||||||||||||
| 296 | $rdf_P->{ns}->{$rdf_P->{context}}->{$_}) { | ||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | # the same prefix bound to different NS in $rdf and $rdf_P | ||||||||||||||||||||||||||||||||||||||||||
| 299 | # launches an error to prevent not well-formed XML | ||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | ▶ | if ($rdf_data and $rdf->{ns}->{$rdf->{context}}->{$_} and | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$rdf_data and $rdf->{"ns"}{$rdf->{"context"}}{$_} and $rdf->{"ns"}{$rdf->{"context"}}{$_} ne $rdf_P->{"ns"}{$rdf_P->{"context"}}{$_}
$rdf_data and $rdf->{"ns"}{$rdf->{"context"}}{$_}
MC/DC0%0/3
$rdf_data and $rdf->{"ns"}{$rdf->{"context"}}{$_} and $rdf->{"ns"}{$rdf->{"context"}}{$_} ne $rdf_P->{"ns"}{$rdf_P->{"context"}}{$_}
$rdf_data
$rdf->{"ns"}{$rdf->{"context"}}{$_}
$rdf->{"ns"}{$rdf->{"context"}}{$_} ne $rdf_P->{"ns"}{$rdf_P->{"context"}}{$_}
Truth table0%0/4
A and B and C
A= $rdf_dataB= $rdf->{"ns"}{$rdf->{"context"}}{$_}C= $rdf->{"ns"}{$rdf->{"context"}}{$_} ne $rdf_P->{"ns"}{$rdf_P->{"context"}}{$_}
| |||||||||||||||||||||||||||||||||||||||||||
| 301 | $rdf->{ns}->{$rdf->{context}}->{$_} ne | ||||||||||||||||||||||||||||||||||||||||||
| 302 | $rdf_P->{ns}->{$rdf_P->{context}}->{$_}) { | ||||||||||||||||||||||||||||||||||||||||||
| 303 | my $msg = "$_ -> $rdf->{ns}->{$rdf->{context}}->{$_}, " | ||||||||||||||||||||||||||||||||||||||||||
| 304 | . "$rdf_P->{ns}->{$rdf_P->{context}}->{$_} in " | ||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | . $self->{path} . $path . ' and its parent'; | |||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | $self->doError(7,$msg); | |||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||
| 309 | push @attr, | ||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | ["xmlns:$_" => $rdf_P->{ns}->{$rdf_P->{context}}->{$_}]; | |||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||
| 315 | 1 | $self->doStartElement('directory', \@attr); | |||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | 1 | ▶ | $self->doElement('path', undef, $path) if $self->{details} > 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | 1 | my $atime = localtime($stat[8]); | |||||||||||||||||||||||||||||||||||||||||
| 320 | 1 | my $mtime = localtime($stat[9]); | |||||||||||||||||||||||||||||||||||||||||
| 321 | $self->doElement('access-time', [[epoch => $stat[8]]], $atime) | ||||||||||||||||||||||||||||||||||||||||||
| 322 | 1 | ▶ | if $self->{details} > 2; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 323 | $self->doElement('modify-time', [[epoch => $stat[9]]], $mtime) | ||||||||||||||||||||||||||||||||||||||||||
| 324 | 1 | ▶ | if $self->{details} > 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||
| 326 | # rdf metadata for nested or uppermost dirs dirs | ||||||||||||||||||||||||||||||||||||||||||
| 327 | 1 | ▶ | if ($self->{details} > 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | my $position_set = 0; | |||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | my $cnt = 0; | |||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | ▶ | if ($rdf_data_P) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | $cnt = scalar @{$rdf_P->{triples}}; | |||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | ▶ | for (my $i = 0; $i < $cnt; $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | if ($rdf_P->{triples}->[$i]->[0] eq "<$dirname>") { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | $self->doElement("$doc_prefix:Position",undef,$i+1,1); | |||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | $position_set = 1; | |||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | my $triples = $rdf_P->get_triples("<$dirname>"); | |||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | foreach (@$triples) { | |||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | $_->[2] =~ s/^"(.*)"$/$1/; | |||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | $self->doElement($_->[1],undef,_esc($_->[2]),1); | |||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||
| 344 | # looking for doc:Type = 'document' | ||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | $_->[1] =~ s/^([_a-zA-Z]\w*)*:/$rdf_P->{ns}->{'<>'}->{$1}/; | |||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | ▶ | $stop = 1 | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$_->[1] eq "http://gingerall.org/charlie-doc/1.0/Type" and $_->[2] eq "document"
MC/DC0%0/2
$_->[1] eq "http://gingerall.org/charlie-doc/1.0/Type" and $_->[2] eq "document"
$_->[1] eq "http://gingerall.org/charlie-doc/1.0/Type"
$_->[2] eq "document"
Truth table0%0/3
A and B
A= $_->[1] eq "http://gingerall.org/charlie-doc/1.0/Type"B= $_->[2] eq "document"
| |||||||||||||||||||||||||||||||||||||||||||
| 347 | if $_->[1] eq 'http://gingerall.org/charlie-doc/1.0/Type' | ||||||||||||||||||||||||||||||||||||||||||
| 348 | and $_->[2] eq 'document'; | ||||||||||||||||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | ▶ | if ($self->{rdf_enabled} and not($position_set)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"rdf_enabled"} and not $position_set
MC/DC0%0/2
$self->{"rdf_enabled"} and not $position_set
$self->{"rdf_enabled"}
not $position_set
Truth table0%0/3
A and not(B)
A= $self->{"rdf_enabled"}B= not $position_set
| |||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | $self->_doUnknownPosition($cnt, $doc_prefix); | |||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||
| 356 | 1 | foreach my $d (@{$self->_readdir()}) { | |||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||
| 358 | 8 | ▶ | if (-d $d) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||
| 360 | # nested dirs | ||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | ▶ | if ($self->{depth} > $level) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | $level++; | |||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | my $path = File::Spec::Functions::catfile($path, $d); | |||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | ▶ | unless ($stop) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | my $parent_dir = $self->{path} . $path; | |||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | $parent_dir =~ s/[^\/\\]+$//; | |||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | $parent_dir = File::Spec::Functions::canonpath($parent_dir); | |||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | ▶ | chdir $d or croak "Cannot chdir to $d, $!\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | $self->_directory($path, $d, $level, $rdf_data, $rdf); | |||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | chdir $parent_dir; | |||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | $level--; | |||||||||||||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||
| 379 | # final dirs | ||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | ▶ | if ($self->{depth} == $level) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | my $path = File::Spec::Functions::catfile($path, $d); | |||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | my @stat = stat "$d"; | |||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | $d =~ s/&/&/; | |||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | my @attr = ([name => $d]); | |||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | ▶ | push @attr, ['depth', $level] if $self->{details} > 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | ▶ | push @attr, ['uid', $stat[4]] if $self->{details} > 2; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | ▶ | push @attr, ['gid', $stat[5]] if $self->{details} > 2; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | ▶ | if ($self->{details} == 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | $self->doElement('directory', \@attr, undef) | |||||||||||||||||||||||||||||||||||||||||
| 394 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | $self->doStartElement('directory', \@attr); | |||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | $self->doElement('path', undef, $path); | |||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | my $atime = localtime($stat[8]); | |||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | my $mtime = localtime($stat[9]); | |||||||||||||||||||||||||||||||||||||||||
| 400 | $self->doElement('access-time', [[epoch => $stat[8]]], $atime) | ||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | ▶ | if $self->{details} > 2; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | $self->doElement('modify-time', [[epoch => $stat[9]]], $mtime); | |||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||
| 404 | # rdf metadata | ||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | my $position_set = 0; | |||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | my $cnt = 0; | |||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | ▶ | if ($rdf_data) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | $cnt = scalar @{$rdf->{triples}}; | |||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | ▶ | for (my $i = 0; $i < $cnt; $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | ▶ | if ($rdf->{triples}->[$i]->[0] eq "<$d>") { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | $self->doElement("$doc_prefix:Position",undef,$i+1,1); | |||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | $position_set = 1; | |||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | my $triples = $rdf->get_triples("<$d>"); | |||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | foreach (@$triples) { | |||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | $_->[2] =~ s/^"(.*)"$/$1/; | |||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | $self->doElement($_->[1],undef,_esc($_->[2]),1); | |||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | ▶ | if ($self->{rdf_enabled} and not($position_set)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"rdf_enabled"} and not $position_set
MC/DC0%0/2
$self->{"rdf_enabled"} and not $position_set
$self->{"rdf_enabled"}
not $position_set
Truth table0%0/3
A and not(B)
A= $self->{"rdf_enabled"}B= not $position_set
| |||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | $self->_doUnknownPosition($cnt, $doc_prefix); | |||||||||||||||||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | $self->doEndElement('directory'); | |||||||||||||||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||
| 430 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 431 | # files | ||||||||||||||||||||||||||||||||||||||||||
| 432 | 8 | ▶ | unless ($stop) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 433 | 8 | ▶ | unless ($d eq $self->{n3_index}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 434 | 8 | $self->_file($d, $level, $rdf_data, $rdf, $doc_prefix); | |||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||
| 436 | } | ||||||||||||||||||||||||||||||||||||||||||
| 437 | } | ||||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||
| 440 | 1 | $self->doEndElement('directory'); | |||||||||||||||||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||
| 443 | 1 | ▶ | sub _readdir { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_readdir: called CC=8 SCAR=24.4
| |||||||||||||||||||||||||||||||||||||||||||
| 444 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||
| 446 | 1 | my $path = &Cwd::getcwd(); | |||||||||||||||||||||||||||||||||||||||||
| 447 | 1 | my $dh = DirHandle->new($path); | |||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||
| 449 | 1 | ▶ | if (! $dh) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | carp $!; | |||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | return []; | |||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||
| 454 | 1 | my @dirs = (); | |||||||||||||||||||||||||||||||||||||||||
| 455 | 1 | my @files = (); | |||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||
| 457 | 1 | foreach ($dh->read()) { | |||||||||||||||||||||||||||||||||||||||||
| 458 | 10 | ▶ | next if $_ =~ /^(\.{1,2})$/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 459 | 8 | ▶ | (-d "$path/$_") ? push @dirs, $_ : push @files, $_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||
| 462 | 1 | ▶ | if ($self->order_by() eq "fd") { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | return [sort(@files),sort(@dirs)]; | |||||||||||||||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||
| 466 | elsif ($self->order_by() eq "a") { | ||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | return [sort(@files,@dirs)]; | |||||||||||||||||||||||||||||||||||||||||
| 468 | } | ||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||
| 470 | elsif ($self->order_by() eq "z") { | ||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | return [sort {$b cmp $a} (@files,@dirs)]; | |||||||||||||||||||||||||||||||||||||||||
| 472 | } | ||||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||
| 474 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 475 | 1 | return [sort(@dirs),sort(@files)]; | |||||||||||||||||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||||||||||||||||
| 477 | } | ||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||
| 479 | 8 | ▶ | sub _file($$$$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_file: called CC=17 SCAR=52.7
| |||||||||||||||||||||||||||||||||||||||||||
| 480 | 8 | my ($self, $name, $level, $rdf_data, $rdf, $doc_prefix) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||
| 482 | 8 | my @stat = stat $name; | |||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||
| 484 | 8 | my @attr = (); | |||||||||||||||||||||||||||||||||||||||||
| 485 | 8 | push @attr, [name => _esc($name)]; | |||||||||||||||||||||||||||||||||||||||||
| 486 | 8 | ▶ | push @attr, [uid => $stat[4]] if $self->{details} > 2; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 487 | 8 | ▶ | push @attr, [gid => $stat[5]] if $self->{details} > 2; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||||||||||||||||
| 489 | 8 | ▶ | if ($self->{details} == 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 490 | 8 | $self->doElement('file', \@attr, undef) | |||||||||||||||||||||||||||||||||||||||||
| 491 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | $self->doStartElement('file', \@attr); | |||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | my $mode; | |||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | ▶ | if (-r $name) {$mode = 'r' }else {$mode = '-'} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | ▶ | if (-w $name) {$mode .= 'w' }else {$mode .= '-'} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | ▶ | if (-x $name) {$mode .= 'x' }else {$mode .= '-'} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 498 | $self->doElement('mode', [[code => $stat[2]]], $mode) | ||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | ▶ | if $self->{details} > 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 500 | $self->doElement('size', [[unit => 'bytes']], $stat[7]) | ||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | ▶ | if $self->{details} > 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | my $atime = localtime($stat[8]); | |||||||||||||||||||||||||||||||||||||||||
| 504 | 0 | my $mtime = localtime($stat[9]); | |||||||||||||||||||||||||||||||||||||||||
| 505 | $self->doElement('access-time', [[epoch => $stat[8]]], $atime) | ||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | ▶ | if $self->{details} > 2; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 507 | $self->doElement('modify-time', [[epoch => $stat[9]]], $mtime) | ||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | ▶ | if $self->{details} > 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||
| 510 | # rdf metadata | ||||||||||||||||||||||||||||||||||||||||||
| 511 | 0 | my $position_set = 0; | |||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | my $cnt = 0; | |||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | ▶ | if ($rdf_data) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | $cnt = scalar @{$rdf->{triples}}; | |||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | ▶ | for (my $i = 0; $i < $cnt; $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | ▶ | if ($rdf->{triples}->[$i]->[0] eq "<$name>") { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | $self->doElement("$doc_prefix:Position",undef,$i+1,1); | |||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | $position_set = 1; | |||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 520 | } | ||||||||||||||||||||||||||||||||||||||||||
| 521 | } | ||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | my $triples = $rdf->get_triples("<$name>"); | |||||||||||||||||||||||||||||||||||||||||
| 523 | 0 | foreach (@$triples) { | |||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | $_->[2] =~ s/^"(.*)"$/$1/; | |||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | $self->doElement($_->[1],undef,_esc($_->[2]),1); | |||||||||||||||||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||||||||||||||||
| 527 | } | ||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | ▶ | if ($self->{rdf_enabled} and not($position_set)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"rdf_enabled"} and not $position_set
MC/DC0%0/2
$self->{"rdf_enabled"} and not $position_set
$self->{"rdf_enabled"}
not $position_set
Truth table0%0/3
A and not(B)
A= $self->{"rdf_enabled"}B= not $position_set
| |||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | $self->_doUnknownPosition($cnt, $doc_prefix); | |||||||||||||||||||||||||||||||||||||||||
| 530 | } | ||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | $self->doEndElement('file'); | |||||||||||||||||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||||||||||||||||
| 533 | } | ||||||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | ▶ | sub _ns_declaration { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ns_declaration: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | ▶ | return '' unless $self->{ns_enabled}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | ▶ | return $self->{ns_prefix} ? "xmlns:$self->{ns_prefix}" : 'xmlns'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 540 | } | ||||||||||||||||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | ▶ | sub _doUnknownPosition { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_doUnknownPosition: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | my ($self, $cnt, $prefix) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | $self->doElement("$prefix:Position", undef, $cnt + $self->{seq}, 1); | |||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | $self->{seq}++; | |||||||||||||||||||||||||||||||||||||||||
| 547 | } | ||||||||||||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||||||||||||
| 549 | 8 | ▶ | sub _esc { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_esc: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 550 | 8 | my $str = shift; | |||||||||||||||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||||||||||||||||
| 552 | 8 | $str =~ s/&/&/g; | |||||||||||||||||||||||||||||||||||||||||
| 553 | 8 | $str =~ s/</</g; | |||||||||||||||||||||||||||||||||||||||||
| 554 | 8 | $str =~ s/>/>/g; | |||||||||||||||||||||||||||||||||||||||||
| 555 | 8 | return $str; | |||||||||||||||||||||||||||||||||||||||||
| 556 | } | ||||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | ▶ | sub _try_to_parse { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_try_to_parse: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 559 | 0 | my ($rdf, $path) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | my $done = 0; | |||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | my $count = 0; | |||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | ▶ | until ($done or $count == 10) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$done or $count == 10
MC/DC0%0/2
$done or $count == 10
$done
$count == 10
Truth table0%0/3
A or B
A= $doneB= $count == 10
| |||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | eval {$rdf->parse_file("$path")}; | |||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | ▶ | unless ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | $done = 1; | |||||||||||||||||||||||||||||||||||||||||
| 567 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 568 | 0 | select(undef, undef, undef, 0.02); | |||||||||||||||||||||||||||||||||||||||||
| 569 | 0 | $count++; | |||||||||||||||||||||||||||||||||||||||||
| 570 | } | ||||||||||||||||||||||||||||||||||||||||||
| 571 | } | ||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | ▶ | die $@ if $@; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 573 | } | ||||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | ▶ | sub _msg { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_msg: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 576 | 0 | my ($self, $no) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | my %msg = ( | |||||||||||||||||||||||||||||||||||||||||
| 579 | 1 => 'details value invalid', | ||||||||||||||||||||||||||||||||||||||||||
| 580 | 2 => 'depth value invalid', | ||||||||||||||||||||||||||||||||||||||||||
| 581 | 3 => 'parse error', | ||||||||||||||||||||||||||||||||||||||||||
| 582 | 4 => 'input source not supported', | ||||||||||||||||||||||||||||||||||||||||||
| 583 | 5 => 'required module not found', | ||||||||||||||||||||||||||||||||||||||||||
| 584 | 6 => 'RDF data parse error', | ||||||||||||||||||||||||||||||||||||||||||
| 585 | 7 => 'prefix bound to 2 namespaces', | ||||||||||||||||||||||||||||||||||||||||||
| 586 | 8 => 'content handler not found', | ||||||||||||||||||||||||||||||||||||||||||
| 587 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||||||||||||
| 589 | 0 | return $msg{$no}; | |||||||||||||||||||||||||||||||||||||||||
| 590 | } | ||||||||||||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||||||||||||
| 592 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||
| 594 | __END__ | ||||||||||||||||||||||||||||||||||||||||||