line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ContentOfRandomFileTestOptions; |
2
|
1
|
|
|
1
|
|
463
|
use base qw/RandomFileMethodAllTests/; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
69
|
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
19
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
21
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
4
|
use File::Random; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
489
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub _no_cvs_subdir_check($); |
10
|
|
|
|
|
|
|
sub _guess_filename(@); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Replace random_file with calling content_of_random_file |
13
|
|
|
|
|
|
|
# Analyze the content and return the file name because of the analysis |
14
|
|
|
|
|
|
|
sub random_file { |
15
|
18060
|
|
|
18060
|
0
|
131298
|
my ($self, %args) = @_; |
16
|
|
|
|
|
|
|
my @content = $self->content_of_random_file( |
17
|
|
|
|
|
|
|
%args, |
18
|
|
|
|
|
|
|
(exists($args{-check}) and (ref($args{-check}) !~ /CODE|Regexp/)) |
19
|
|
|
|
|
|
|
? () # -check option without a sensful value, should surely fail |
20
|
|
|
|
|
|
|
: (-check => _no_cvs_subdir_check $args{-check}) |
21
|
18060
|
100
|
100
|
|
|
97550
|
); |
22
|
18024
|
|
|
|
|
100273
|
return _guess_filename @content; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _no_cvs_subdir_check($) { |
26
|
84000
|
|
100
|
84000
|
|
306344
|
my $check = shift() || sub {"no checking done - always true"}; |
|
18042
|
|
|
18042
|
|
84460
|
|
27
|
|
|
|
|
|
|
return sub { |
28
|
135000
|
50
|
|
135000
|
|
304409
|
return 0 if /CVS/; # filename seems to be in a CVS subdir |
29
|
135000
|
100
|
|
|
|
487569
|
ref($check) eq 'Regexp' ? return /$check/ : return $check->(@_) |
30
|
18042
|
|
|
|
|
81824
|
}; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# In the fileX files there's only one line "Content: fileX" |
34
|
|
|
|
|
|
|
# In the [xyz].dat files there are some lines, the 4th line contains the fname |
35
|
|
|
|
|
|
|
sub _guess_filename(@) { |
36
|
18024
|
100
|
100
|
18024
|
|
190286
|
$_[0] and $_[0] =~ /^Content: (.*)$/ and return $1; |
37
|
5151
|
100
|
66
|
|
|
40851
|
$_[3] and chomp($_[3]),$_[3] =~ /^(\w\.dat)$/ and return $1; |
38
|
2274
|
|
|
|
|
10054
|
return undef; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |