Branch Coverage

blib/lib/File/Random.pm
Criterion Covered Total %
branch 44 46 95.6


line true false branch
42 12250 24316 $recursive ? :
50 2274 16250 unless my $rf = random_file(%args)
53 0 16250 unless open RANDOM_FILE, '<', "$dir/$rf"
57 15750 500 wantarray ? :
62 1 344 unless defined $fname
63 68 276 if (not defined $nr_of_lines and wantarray)
66 2 342 unless (not defined $nr_of_lines or $nr_of_lines =~ /^\d+$/)
69 1 341 if defined $nr_of_lines and $nr_of_lines == 0
74 2 340 unless open FILE, '<', $fname
75 203 137 if ($nr_of_lines == 1) { }
80 1 136 unless wantarray
84 1892 3748 if rand $. < 1
89 137 203 wantarray ? :
95 18 24298 unless opendir DIR, $dir
96 128000 88192 if -f "$dir/$_"
99 4548 19750 unless @files
110 49000 147000 unless -f $_
114 9000 138000 unless _valid_file($check, $f)
117 36886 101114 if (rand $i++ < 1)
129 254000 0 unless /Regexp/ and return $name =~ /$check/
143 36 183004 if exists $args{$_} and not $args{$_}
148 48 75587 unless /^\-(d|dir|directory| c|check| r|rec|recursive| f|follow)$/x
159 18 36566 unless (not defined $check or scalar ref($check) =~ /^(Regexp|CODE)$/)