blib/lib/Devel/Cover/Annotation/Random.pm untested

filter: Statementstmt 0.0% 0 / 38 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 8 totaltotal 0.0% 0 / 65 CC 5 SCAR 16.2
CC
5
Cov
0%
text
12.0
get_options
6.0
class
6.0
CRAP 5.1
1 # Copyright 2004-2026, Paul Johnson (paul@pjcj.net)
2  
3 # This software is free. It is licensed under the same terms as Perl itself.
4  
5 # The latest version of this software should be available from my homepage:
6 # https://pjcj.net
7  
8 package Devel::Cover::Annotation::Random;
9  
10 use strict;
11 use warnings;
12  
13 our $VERSION = '1.52'; # VERSION
14  
15 use Getopt::Long;
16  
17 sub new {
18 my $class = shift;
19 bless {@_}, $class
20 }
21  
22 sub get_options {
23 my ($self, $opt) = @_;
24 $self->{count} = 1;
25 die "Bad option" unless GetOptions(
26 $self, qw(
27 count=s
28 )
29 );
30 }
31  
32 sub count {
33 my $self = shift;
34 $self->{count}
35 }
36  
37 sub header {
38 my $self = shift;
39 my ($annotation) = @_;
40 "rnd$annotation"
41 }
42  
43 sub width {
44 my $self = shift;
45 my ($annotation) = @_;
46 length $self->header($annotation)
47 }
48  
49 sub text {
50 my $self = shift;
51 my ($file, $line, $annotation) = @_;
52 return "" unless $line;
53 $self->{annotation}{$file}[$line][$annotation] = int rand 10
54 unless defined $self->{annotation}{$file}[$line][$annotation];
55 $self->{annotation}{$file}[$line][$annotation]
56 }
57  
58 sub error {
59 my $self = shift;
60 my ($file, $line, $annotation) = @_;
61 !$self->text($file, $line, $annotation)
62 }
63  
64 sub class {
65 my $self = shift;
66 my ($file, $line, $annotation) = @_;
67 return "" unless $line;
68 "c" . int(($self->text($file, $line, $annotation) + 2) / 3)
69 }
70  
71 1
72  
73 __END__