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