line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CFDI::Parser::Path;
|
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
4
|
1
|
|
|
1
|
|
4
|
use File::Spec;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
15
|
|
5
|
1
|
|
|
1
|
|
3
|
use Cwd;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
325
|
|
6
|
|
|
|
|
|
|
require Exporter;
|
7
|
|
|
|
|
|
|
our @EXPORT = qw(findxml);
|
8
|
|
|
|
|
|
|
our @ISA = qw(Exporter);
|
9
|
|
|
|
|
|
|
our $VERSION = 0.3;
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub findxml(_){
|
12
|
0
|
0
|
|
0
|
0
|
|
die 'path not defined' unless defined $_[0];
|
13
|
0
|
0
|
0
|
|
|
|
die "cannot read path $_[0]" unless -e $_[0] && -r _;
|
14
|
0
|
0
|
|
|
|
|
die "path $_[0] is not a directory" unless -d _;
|
15
|
0
|
|
|
|
|
|
my ($wd,@paths,@xml) = (getcwd,$_[0]);
|
16
|
0
|
|
|
|
|
|
while(@paths){
|
17
|
0
|
|
|
|
|
|
my $path = shift @paths;
|
18
|
0
|
0
|
0
|
|
|
|
next unless -e $path && -r _ && -d _;
|
|
|
|
0
|
|
|
|
|
19
|
0
|
0
|
|
|
|
|
opendir DIR,$path or next;
|
20
|
0
|
0
|
|
|
|
|
chdir $path or next;
|
21
|
0
|
|
|
|
|
|
foreach(grep !/^\./,readdir DIR){
|
22
|
0
|
0
|
0
|
|
|
|
next unless -e && -r _;
|
23
|
0
|
0
|
|
|
|
|
if(-d _){
|
|
|
0
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
push @paths,File::Spec->catdir($path,$_);
|
25
|
|
|
|
|
|
|
}elsif(/\.xml$/i){
|
26
|
0
|
|
|
|
|
|
push @xml,File::Spec->catfile($path,$_);
|
27
|
|
|
|
|
|
|
}
|
28
|
|
|
|
|
|
|
}
|
29
|
0
|
|
|
|
|
|
chdir $wd;
|
30
|
0
|
|
|
|
|
|
closedir DIR;
|
31
|
|
|
|
|
|
|
}
|
32
|
0
|
|
|
|
|
|
@xml;
|
33
|
|
|
|
|
|
|
}
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |