| 1 | package CPAN::Testers::Common::Article; | ||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||
| 3 | 8 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 4 | 8 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 5 | 8 | ▶ | use vars qw($VERSION); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||
| 7 | 8 | $VERSION = '0.46'; | |||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||
| 9 | #---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 10 | # Library Modules | ||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||
| 12 | 8 | ▶ | use CPAN::DistnameInfo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 13 | 8 | ▶ | use Email::Simple; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 14 | 8 | ▶ | use MIME::Base64; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 15 | 8 | ▶ | use MIME::QuotedPrint; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 16 | 8 | ▶ | use Time::Local; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||
| 18 | 8 | ▶ | use base qw( Class::Accessor::Fast ); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||
| 20 | #---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 21 | # Variables | ||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||
| 23 | 8 | my %month = ( | |||||||||||||||||||||||||||||||
| 24 | Jan => 1, Feb => 2, Mar => 3, Apr => 4, May => 5, Jun => 6, | ||||||||||||||||||||||||||||||||
| 25 | Jul => 7, Aug => 8, Sep => 9, Oct => 10, Nov => 11, Dec => 12, | ||||||||||||||||||||||||||||||||
| 26 | ); | ||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||
| 28 | 8 | my @perl_extractions = ( | |||||||||||||||||||||||||||||||
| 29 | # Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration: | ||||||||||||||||||||||||||||||||
| 30 | # Summary of my perl5 (revision 5 version 10 subversion 0) configuration: | ||||||||||||||||||||||||||||||||
| 31 | qr/Summary of my (?:perl(?:\d+)?)? \((?:revision )?(\d+(?:\.\d+)?) (?:version|patchlevel) (\d+) subversion\s+(\d+) ?(.*?)\) configuration/, | ||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||
| 33 | # the following is experimental and may provide incorrect data | ||||||||||||||||||||||||||||||||
| 34 | qr!/(?:(?:site_perl|perl|perl5|\.?cpanplus)/|perl-)(5)\.?([6-9]|1[0-2])\.?(\d+)/!, | ||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||
| 36 | # this dissects the report introduction and is used in the event that | ||||||||||||||||||||||||||||||||
| 37 | # the report gets truncated and no perl -V information is available. | ||||||||||||||||||||||||||||||||
| 38 | qr/on Perl (\d+)\.(\d+)(?:\.(\d+))?/i, | ||||||||||||||||||||||||||||||||
| 39 | ); | ||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||
| 41 | 8 | my %regexes = ( | |||||||||||||||||||||||||||||||
| 42 | # with time | ||||||||||||||||||||||||||||||||
| 43 | 1 => { re => qr/(?:\w+,)?\s+(\d+)\s+(\w+)\s+(\d+)\s+(\d+):(\d+)/, f => [qw(day month year hour min)] }, # Wed, 13 September 2004 06:29 | ||||||||||||||||||||||||||||||||
| 44 | 2 => { re => qr/(\d+)\s+(\w+)\s+(\d+)\s+(\d+):(\d+)/, f => [qw(day month year hour min)] }, # 13 September 2004 06:29 | ||||||||||||||||||||||||||||||||
| 45 | 3 => { re => qr/(\w+)?\s+(\d+),?\s+(\d+)\s+(\d+):(\d+)/, f => [qw(month day year hour min)] }, # September 22, 1999 06:29 | ||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||
| 47 | # just the date | ||||||||||||||||||||||||||||||||
| 48 | 4 => { re => qr/(?:\w+,)?\s+(\d+)\s+(\w+)\s+(\d+)/, f => [qw(day month year)] }, # Wed, 13 September 2004 | ||||||||||||||||||||||||||||||||
| 49 | 5 => { re => qr/(\d+)\s+(\w+)\s+(\d+)/, f => [qw(day month year)] }, # 13 September 2004 | ||||||||||||||||||||||||||||||||
| 50 | 6 => { re => qr/(\w+)?\s+(\d+),?\s+(\d+)/, f => [qw(month day year)] }, # September 22, 1999 | ||||||||||||||||||||||||||||||||
| 51 | ); | ||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||
| 53 | 8 | my $OSNAMES = qr/(cygwin|freebsd|netbsd|openbsd|darwin|linux|cygwin|darwin|MSWin32|dragonfly|solaris|MacOS|irix|mirbsd|gnu|bsdos|aix|sco|os2|haiku|beos|midnight)/i; | |||||||||||||||||||||||||||||||
| 54 | 8 | my %OSNAMES = ( | |||||||||||||||||||||||||||||||
| 55 | 'MacPPC' => 'macos', | ||||||||||||||||||||||||||||||||
| 56 | 'osf' => 'dec_osf', | ||||||||||||||||||||||||||||||||
| 57 | 'pa-risc' => 'hpux', | ||||||||||||||||||||||||||||||||
| 58 | 's390' => 'os390', | ||||||||||||||||||||||||||||||||
| 59 | 'VMS_' => 'vms', | ||||||||||||||||||||||||||||||||
| 60 | 'ARCHREV_0' => 'hpux', | ||||||||||||||||||||||||||||||||
| 61 | 'linuxThis' => 'linux', | ||||||||||||||||||||||||||||||||
| 62 | 'linThis' => 'linux', | ||||||||||||||||||||||||||||||||
| 63 | 'linuThis' => 'linux', | ||||||||||||||||||||||||||||||||
| 64 | 'lThis' => 'linux', | ||||||||||||||||||||||||||||||||
| 65 | 'openThis' => 'openbsd', | ||||||||||||||||||||||||||||||||
| 66 | ); | ||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||
| 68 | #---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 69 | # The Public API | ||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||
| 71 | 8 | __PACKAGE__->mk_accessors( | |||||||||||||||||||||||||||||||
| 72 | qw( | ||||||||||||||||||||||||||||||||
| 73 | raw cooked header body | ||||||||||||||||||||||||||||||||
| 74 | postdate date epoch status from distribution version | ||||||||||||||||||||||||||||||||
| 75 | perl osname osvers archname subject author filename | ||||||||||||||||||||||||||||||||
| 76 | osname_patterns osname_fixes | ||||||||||||||||||||||||||||||||
| 77 | ) | ||||||||||||||||||||||||||||||||
| 78 | ); | ||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||
| 80 | sub new { | ||||||||||||||||||||||||||||||||
| 81 | 18 | ▶ | my($class, $article) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 82 | 18 | my $self = {}; | |||||||||||||||||||||||||||||||
| 83 | 18 | bless $self, $class; | |||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||
| 85 | 18 | $self->raw($article); | |||||||||||||||||||||||||||||||
| 86 | 18 | ▶ | $article = decode_qp($article) if($article =~ /=3D/); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 87 | 18 | $self->cooked($article); | |||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||
| 89 | 18 | my $mail; | |||||||||||||||||||||||||||||||
| 90 | 18 | eval { $mail = Email::Simple->new($article) }; | |||||||||||||||||||||||||||||||
| 91 | 18 | ▶ | return unless $mail; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||
| 93 | 18 | $self->header($mail->header_obj()); | |||||||||||||||||||||||||||||||
| 94 | 18 | $self->body($mail->body()); | |||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||
| 96 | 18 | ▶ | return if $mail->header("In-Reply-To"); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||
| 98 | 16 | my $from = $mail->header("From"); | |||||||||||||||||||||||||||||||
| 99 | 16 | my $subject = $mail->header("Subject"); | |||||||||||||||||||||||||||||||
| 100 | 16 | ▶ | return unless $subject; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 101 | 14 | ▶ | return if $subject =~ /::/; # it's supposed to be a distribution | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||
| 103 | 13 | $self->osname_patterns( $OSNAMES ); | |||||||||||||||||||||||||||||||
| 104 | 13 | $self->osname_fixes( \%OSNAMES ); | |||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||
| 106 | 13 | $self->{mail} = $mail; | |||||||||||||||||||||||||||||||
| 107 | 13 | $self->{from} = $from; | |||||||||||||||||||||||||||||||
| 108 | 13 | $self->{subject} = $subject; | |||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||
| 110 | 13 | ($self->{postdate},$self->{date},$self->{epoch}) = $self->_parse_date($mail); | |||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||
| 112 | 13 | return $self; | |||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||
| 115 | sub parse_upload { | ||||||||||||||||||||||||||||||||
| 116 | 10 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
parse_upload: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||
| 117 | 10 | my $mail = $self->{mail}; | |||||||||||||||||||||||||||||||
| 118 | 10 | my $subject = $self->{subject}; | |||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||
| 120 | 10 | ▶ | return 0 unless($subject =~ /CPAN Upload:\s+([-\w\/\.\+]+)/i); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 121 | 7 | my $distvers = $1; | |||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||
| 123 | # only record supported archives | ||||||||||||||||||||||||||||||||
| 124 | 7 | ▶ | return 0 if($distvers !~ /\.(?:(?:tar\.|t)(?:gz|bz2)|zip)$/); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||
| 126 | # CPAN::DistnameInfo doesn't support .tar.bz2 files ... yet | ||||||||||||||||||||||||||||||||
| 127 | 5 | $distvers =~ s/\.(?:tar\.|t)bz2$//i; | |||||||||||||||||||||||||||||||
| 128 | 5 | ▶ | $distvers .= '.tar.gz' unless $distvers =~ /\.(?:(?:tar\.|t)gz|zip)$/i; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||
| 130 | # CPAN::DistnameInfo doesn't support old form of uploads | ||||||||||||||||||||||||||||||||
| 131 | 5 | my @parts = split("/",$distvers); | |||||||||||||||||||||||||||||||
| 132 | 5 | ▶ | if(@parts == 2) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 133 | 1 | my ($first,$second,$rest) = split(//,$distvers,3); | |||||||||||||||||||||||||||||||
| 134 | 1 | $distvers = "$first/$first$second/$first$second$rest"; | |||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||
| 137 | 5 | my $d = CPAN::DistnameInfo->new($distvers); | |||||||||||||||||||||||||||||||
| 138 | 5 | $self->distribution($d->dist); | |||||||||||||||||||||||||||||||
| 139 | 5 | $self->version($d->version); | |||||||||||||||||||||||||||||||
| 140 | 5 | $self->author($d->cpanid); | |||||||||||||||||||||||||||||||
| 141 | 5 | $self->filename($d->filename); | |||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||
| 143 | 5 | return 1; | |||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||
| 146 | sub parse_report { | ||||||||||||||||||||||||||||||||
| 147 | 12 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
parse_report: called CC=27 SCAR=33.4
Pod
documented
| |||||||||||||||||||||||||||||||||
| 148 | 12 | my $mail = $self->{mail}; | |||||||||||||||||||||||||||||||
| 149 | 12 | my $from = $self->{from}; | |||||||||||||||||||||||||||||||
| 150 | 12 | my $subject = $self->{subject}; | |||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||
| 152 | 12 | my ($status, $distversion, $platform, $osver) = split /\s+/, $subject; | |||||||||||||||||||||||||||||||
| 153 | 12 | ▶ | return 0 unless $status =~ /^(PASS|FAIL|UNKNOWN|NA)$/i; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||
| 155 | 10 | ▶ | $platform ||= ""; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$platform ||= ""
MC/DC100%1/1
$platform ||= ""
$platform
Truth table100%2/2
A
A= $platform
| |||||||||||||||||||||||||||||||||
| 156 | 10 | $platform =~ s/[\s&,<].*//; | |||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||
| 158 | 10 | ▶ | $distversion ||= ""; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$distversion ||= ""
MC/DC100%1/1
$distversion ||= ""
$distversion
Truth table100%2/2
A
A= $distversion
| |||||||||||||||||||||||||||||||||
| 159 | 10 | $distversion =~ s!/$!!; | |||||||||||||||||||||||||||||||
| 160 | 10 | $distversion =~ s/\.tar.*/.tar.gz/; | |||||||||||||||||||||||||||||||
| 161 | 10 | ▶ | $distversion .= '.tar.gz' unless $distversion =~ /\.(tar|tgz|zip)/; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||
| 163 | 10 | my $d = CPAN::DistnameInfo->new($distversion); | |||||||||||||||||||||||||||||||
| 164 | 10 | my ($dist, $version) = ($d->dist, $d->version); | |||||||||||||||||||||||||||||||
| 165 | 10 | ▶ | return 0 unless defined $dist; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 166 | 9 | ▶ | return 0 unless defined $version; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||
| 168 | 8 | my $encoding = $mail->header('Content-Transfer-Encoding'); | |||||||||||||||||||||||||||||||
| 169 | 8 | my $head = $mail->header("X-Test-Reporter-Perl"); | |||||||||||||||||||||||||||||||
| 170 | 8 | my $body = $mail->body; | |||||||||||||||||||||||||||||||
| 171 | 8 | ▶ | $body = decode_base64($body) if($encoding && $encoding eq 'base64'); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$encoding and $encoding eq "base64"
MC/DC0%0/2
$encoding and $encoding eq "base64"
$encoding
$encoding eq "base64"
Truth table66%2/3
A and B
A= $encodingB= $encoding eq "base64"
| |||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||
| 173 | 8 | my $perl = $self->_extract_perl_version($body,$head); | |||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||
| 175 | 8 | my ($osname) = $body =~ /(?:Summary of my perl5|Platform:).*?osname=([^\s\n,<\']+)/s; | |||||||||||||||||||||||||||||||
| 176 | 8 | my ($osvers) = $body =~ /(?:Summary of my perl5|Platform:).*?osvers=([^\s\n,<\']+)/s; | |||||||||||||||||||||||||||||||
| 177 | 8 | my ($archname) = $body =~ /(?:Summary of my perl5|Platform:).*?archname=([^\s\n&,<\']+)/s; | |||||||||||||||||||||||||||||||
| 178 | 8 | ▶ | $archname =~ s/\n.*// if($archname); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||
| 180 | 8 | $self->status($status); | |||||||||||||||||||||||||||||||
| 181 | 8 | $self->distribution($dist); | |||||||||||||||||||||||||||||||
| 182 | 8 | $self->version($version); | |||||||||||||||||||||||||||||||
| 183 | 8 | ▶ | $self->from($from || ""); | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$from || ''
MC/DC100%1/1
$from || ''
$from
Truth table100%2/2
A
A= $from
| |||||||||||||||||||||||||||||||||
| 184 | 8 | $self->perl($perl); | |||||||||||||||||||||||||||||||
| 185 | 8 | $self->filename($d->filename); | |||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||
| 187 | 8 | ▶ | unless($archname || $platform) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$archname or $platform
MC/DC100%2/2
$archname or $platform
$archname
$platform
Truth table100%3/3
A or B
A= $archnameB= $platform
| |||||||||||||||||||||||||||||||||
| 188 | 3 | ▶ | if($osname && $osvers) { $platform = "$osname-$osvers" } | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
$osname and $osvers
MC/DC100%2/2
$osname and $osvers
$osname
$osvers
Truth table100%3/3
A and B
A= $osnameB= $osvers
| |||||||||||||||||||||||||||||||||
| 189 | 1 | elsif($osname) { $platform = $osname } | |||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||
| 192 | 8 | ▶ | unless($osname) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 193 | 2 | my $patterns = $self->osname_patterns; | |||||||||||||||||||||||||||||||
| 194 | 2 | my $fixes = $self->osname_fixes; | |||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||
| 196 | 2 | for my $text ($platform, $archname) { | |||||||||||||||||||||||||||||||
| 197 | 3 | ▶ | next unless($text); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 198 | 1 | ▶ | if($text =~ $patterns) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 199 | 1 | $osname = $1; | |||||||||||||||||||||||||||||||
| 200 | } else { | ||||||||||||||||||||||||||||||||
| 201 | 0 | for my $rx (keys %$fixes) { | |||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | if($text =~ /$rx/i) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 203 | 0 | $osname = $fixes->{$rx}; | |||||||||||||||||||||||||||||||
| 204 | 0 | last; | |||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||
| 208 | 1 | ▶ | last if($osname); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||
| 212 | 8 | ▶ | $osvers ||= $osver; | ||||||||||||||||||||||||||||||
|
Condition66%2/3
$osvers ||= $osver
MC/DC50%1/2
$osvers ||= $osver
$osvers
$osver
Truth table66%2/3
A ||= B
A= $osversB= $osver
| |||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||
| 214 | 8 | ▶ | $self->osname($osname || ""); | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$osname || ''
MC/DC100%1/1
$osname || ''
$osname
Truth table100%2/2
A
A= $osname
| |||||||||||||||||||||||||||||||||
| 215 | 8 | ▶ | $self->osvers($osvers || ""); | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$osvers || ''
MC/DC100%1/1
$osvers || ''
$osvers
Truth table100%2/2
A
A= $osvers
| |||||||||||||||||||||||||||||||||
| 216 | 8 | ▶ | $self->archname($archname || $platform); | ||||||||||||||||||||||||||||||
|
Condition100%3/3
$archname || $platform
MC/DC100%2/2
$archname || $platform
$archname
$platform
Truth table100%3/3
A || B
A= $archnameB= $platform
| |||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||
| 218 | 8 | return 1; | |||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||
| 221 | sub passed { | ||||||||||||||||||||||||||||||||
| 222 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
passed: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 223 | 3 | return $self->status eq 'PASS'; | |||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||
| 226 | sub failed { | ||||||||||||||||||||||||||||||||
| 227 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
failed: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 228 | 3 | return $self->status eq 'FAIL'; | |||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||
| 231 | #---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 232 | # The Private Methods | ||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||
| 234 | sub _parse_date { | ||||||||||||||||||||||||||||||||
| 235 | 13 | ▶ | my ($self,$mail) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
_parse_date: called CC=4 SCAR=15.2
| |||||||||||||||||||||||||||||||||
| 236 | 13 | my ($date1,$date2,$date3) = $self->_extract_date($mail->header("Date")); | |||||||||||||||||||||||||||||||
| 237 | 13 | my @received = $mail->header("Received"); | |||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||
| 239 | 13 | for my $hdr (@received) { | |||||||||||||||||||||||||||||||
| 240 | 68 | ▶ | next unless($hdr =~ /.*;\s+(.*)\s*$/); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 241 | 68 | my ($dt1,$dt2,$dt3) = $self->_extract_date($1); | |||||||||||||||||||||||||||||||
| 242 | 68 | ▶ | if($dt2 > $date2 + 1200) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 243 | 0 | $date1 = $dt1; | |||||||||||||||||||||||||||||||
| 244 | 0 | $date2 = $dt2; | |||||||||||||||||||||||||||||||
| 245 | 0 | $date3 = $dt3; | |||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||
| 249 | #print STDERR " ... X.[Date: ".($date||'')."]\n"; | ||||||||||||||||||||||||||||||||
| 250 | 13 | return($date1,$date2,$date3); | |||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||
| 253 | sub _extract_date { | ||||||||||||||||||||||||||||||||
| 254 | 93 | ▶ | my ($self,$date) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
_extract_date: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||
| 255 | 93 | my (%fields,@fields,$index); | |||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||
| 257 | #print STDERR "# ... 0.[Date: ".($date||'')."]\n"; | ||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||
| 259 | 93 | for my $inx (sort {$a <=> $b} keys %regexes) { | |||||||||||||||||||||||||||||||
| 260 | 187 | (@fields) = ($date =~ $regexes{$inx}->{re}); | |||||||||||||||||||||||||||||||
| 261 | 187 | ▶ | if(@fields) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 262 | 90 | $index = $inx; | |||||||||||||||||||||||||||||||
| 263 | 90 | last; | |||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||
| 267 | 93 | ▶ | return('000000','000000000000',0) unless($index); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||
| 269 | 90 | @fields{@{$regexes{$index}->{f}}} = @fields; | |||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||
| 271 | 90 | $fields{month} = substr($fields{month},0,3); | |||||||||||||||||||||||||||||||
| 272 | 90 | $fields{mon} = $month{$fields{month}}; | |||||||||||||||||||||||||||||||
| 273 | 90 | ▶ | return('000000','000000000000',0) unless($fields{mon} && $fields{year} > 1998); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$fields{"mon"} and $fields{"year"} > 1998
MC/DC100%2/2
$fields{"mon"} and $fields{"year"} > 1998
$fields{"mon"}
$fields{"year"} > 1998
Truth table100%3/3
A and B
A= $fields{"mon"}B= $fields{"year"} > 1998
| |||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||
| 275 | 88 | ▶ | $fields{$_} ||= 0 for(qw(sec min hour day mon year)); | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$fields{$_} ||= 0
MC/DC100%1/1
$fields{$_} ||= 0
$fields{$_}
Truth table100%2/2
A
A= $fields{$_}
| |||||||||||||||||||||||||||||||||
| 276 | 88 | my @date = map { $fields{$_} } qw(sec min hour day mon year); | |||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||
| 278 | #print STDERR "# ... 1.[$_][$fields{$_}]\n" for(qw(year month day hour min)); | ||||||||||||||||||||||||||||||||
| 279 | 88 | my $short = sprintf "%04d%02d", $fields{year}, $fields{mon}; | |||||||||||||||||||||||||||||||
| 280 | 88 | my $long = sprintf "%04d%02d%02d%02d%02d", $fields{year}, $fields{mon}, $fields{day}, $fields{hour}, $fields{min}; | |||||||||||||||||||||||||||||||
| 281 | 88 | $date[4]--; | |||||||||||||||||||||||||||||||
| 282 | 88 | my $epoch = timegm(@date); | |||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||
| 284 | 88 | return($short,$long,$epoch); | |||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||
| 287 | # there are a number of test reports that either omitted the perl version | ||||||||||||||||||||||||||||||||
| 288 | # completely, or have had it truncated by the NNTP mail server. In more recent | ||||||||||||||||||||||||||||||||
| 289 | # reports the perl version number is also listed towards the beginning of the | ||||||||||||||||||||||||||||||||
| 290 | # report. The cocde below now attempts to find something in all known places. | ||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||
| 292 | sub _extract_perl_version { | ||||||||||||||||||||||||||||||||
| 293 | 22 | ▶ | my ($self, $body, $head) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
_extract_perl_version: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||
| 294 | 22 | my ($rev, $ver, $sub, $extra); | |||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||
| 296 | 22 | for my $regex (@perl_extractions) { | |||||||||||||||||||||||||||||||
| 297 | 41 | ($rev, $ver, $sub, $extra) = $body =~ /$regex/si; | |||||||||||||||||||||||||||||||
| 298 | 41 | ▶ | last if(defined $rev); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||
| 301 | 22 | ▶ | return 0 unless(defined $rev); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||
| 303 | #$ver ||= 0; # current patterns require ver and sub values | ||||||||||||||||||||||||||||||||
| 304 | #$sub ||= 0; | ||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||
| 306 | 15 | my $perl = $rev + ($ver / 1000) + ($sub / 1000000); | |||||||||||||||||||||||||||||||
| 307 | 15 | $rev = int($perl); | |||||||||||||||||||||||||||||||
| 308 | 15 | $ver = int(($perl*1000)%1000); | |||||||||||||||||||||||||||||||
| 309 | 15 | $sub = int(($perl*1000000)%1000); | |||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||
| 311 | # check for a release candidate (classed as a patch) | ||||||||||||||||||||||||||||||||
| 312 | 15 | ▶ | if($head && $head =~ /v5\.\d+\.\d+ (RC\d+)/) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$head and $head =~ /v5\.\d+\.\d+ (RC\d+)/
MC/DC100%2/2
$head and $head =~ /v5\.\d+\.\d+ (RC\d+)/
$head
$head =~ /v5\.\d+\.\d+ (RC\d+)/
Truth table100%3/3
A and B
A= $headB= $head =~ /v5\.\d+\.\d+ (RC\d+)/
| |||||||||||||||||||||||||||||||||
| 313 | 1 | ▶ | $extra .= ' ' if($extra); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 314 | 1 | $extra .= "$1"; | |||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||
| 317 | 15 | my $version = sprintf "%d.%d.%d", $rev, $ver, $sub; | |||||||||||||||||||||||||||||||
| 318 | 15 | ▶ | $version .= " $extra" if $extra; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 319 | 15 | return $version; | |||||||||||||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||
| 322 | 8 | 1; | |||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||
| 324 | __END__ | ||||||||||||||||||||||||||||||||