blib/lib/ModPerl/VersionUtil.pm

filter: Statementstmt 100% 25 / 25 Branchbran 80.0% 8 / 10 Conditioncond 66.6% 4 / 6 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 87.5% 42 / 48 CC 9 SCAR 19.7
CC
9
Cov
90%
BEGIN
9.2
BEGIN
1.0
BEGIN
1.0
CRAP 7.1
↑ Summary
1 #$Id: VersionUtil.pm,v 1.3 2006/01/17 01:36:51 naoya Exp $
2 package ModPerl::VersionUtil;
3 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 5 ▶use base qw/Class::Data::Inheritable/;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 5 our $VERSION = '0.03';
8  
9 5 ▶BEGIN {
Subroutine BEGIN: called CC=9 SCAR=22.2
10 __PACKAGE__->mk_classdata($_)
11 5 for qw/mp_version mp_version_string is_mp is_mp1 is_mp19 is_mp2/;
12  
13 5 ▶ if (my $version = $ENV{MOD_PERL}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $version = $ENV{"MOD_PERL"}) 3 2 5
14 # Note: This environment variable could be set in an external script called from mod_perl,
15 # so don't presume we are in mod_perl just yet.
16  
17 3 ($version) = $version =~ /^\S+\/(\d+(?:[\.\_]\d+)+)/;
18 3 __PACKAGE__->mp_version_string($version);
19  
20 3 $version =~ s/_//g;
21 3 $version =~ s/(\.[^.]+)\./$1/g;
22 3 __PACKAGE__->mp_version($version);
23  
24 3 ▶ if ($ENV{MOD_PERL_API_VERSION} && $ENV{MOD_PERL_API_VERSION} == 2 && exists $INC{'Apache2/RequestRec.pm'}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($ENV{'MOD_PERL_API_VERSION'} and $ENV{'MOD_PERL_API_VERSION'} == 2 and exists $INC{'Apache2/RequestRec.pm'}) { } 1 2 3
elsif (exists $INC{'Apache.pm'}) { } 2 0 2
Condition66%4/6
$ENV{"MOD_PERL_API_VERSION"} and $ENV{"MOD_PERL_API_VERSION"} == 2 and exists $INC{"Apache2/RequestRec.pm"}
!ll&&!rl&&r
201
$ENV{"MOD_PERL_API_VERSION"} and $ENV{"MOD_PERL_API_VERSION"} == 2
!ll&&!rl&&r
201
MC/DC33%1/3
$ENV{"MOD_PERL_API_VERSION"} and $ENV{"MOD_PERL_API_VERSION"} == 2 and exists $INC{"Apache2/RequestRec.pm"}
$ENV{"MOD_PERL_API_VERSION"} $ENV{"MOD_PERL_API_VERSION"} == 2 exists $INC{"Apache2/RequestRec.pm"}
Truth table50%2/4
A and B and C
A= $ENV{"MOD_PERL_API_VERSION"}B= $ENV{"MOD_PERL_API_VERSION"} == 2C= exists $INC{"Apache2/RequestRec.pm"}
ABCresult
0XX0
10X0
1100
1111
25 1 __PACKAGE__->is_mp(1);
26 1 __PACKAGE__->is_mp2(1)
27 } elsif (exists $INC{'Apache.pm'}) {
28 2 __PACKAGE__->is_mp(1);
29 2 ▶ if ( $version >= 1.9901 ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($version >= 1.9901) { } 1 1 2
elsif ($version >= 1.24) { } 1 0 1
30 1 __PACKAGE__->is_mp19(1);
31 } elsif ( $version >= 1.24 ) {
32 1 __PACKAGE__->is_mp1(1);
33 }
34 }
35 }
36 }
37  
38 5 1;
39  
40 __END__
↑ Summary