lib/Apache/Singleton/Request.pm

filter: Statementstmt 100% 24 / 24 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 100% 33 / 33 CC 2 SCAR 2.2
CC
2
Cov
100%
BEGIN
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« blib/lib/Apache/Singleton/Process.pm ↑ Summary
1 #
2 # This file is part of Apache-Singleton
3 #
4 # This software is copyright (c) 2009 by Michael Schout.
5 #
6 # This is free software; you can redistribute it and/or modify it under
7 # the same terms as the Perl 5 programming language system itself.
8 #
9  
10 package Apache::Singleton::Request;
11 2 $Apache::Singleton::Request::VERSION = '0.17';
12 # ABSTRACT: One instance per One Request
13  
14 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 2 ▶use base 'Apache::Singleton';
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 2 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
20 2 ▶ use constant MP2 => $mod_perl::VERSION >= 1.99 ? 1 : 0;
Subroutine BEGIN: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
$mod_perl::VERSION >= 1.99 ? : 1 1 2
21  
22 2 if (MP2) {
23 require Apache2::RequestUtil;
24 }
25 else {
26 2 require Apache;
27 }
28 }
29  
30 8 ▶sub _get_instance {
Subroutine _get_instance: called CC=1 SCAR=0.0
31 8 my $class = shift;
32 8 my $r = MP2 ? Apache2::RequestUtil->request : Apache->request;
33 8 my $key = "apache_singleton_$class";
34 8 return $r->pnotes($key);
35 }
36  
37 4 ▶sub _set_instance {
Subroutine _set_instance: called CC=1 SCAR=0.0
38 4 my($class, $instance) = @_;
39 4 my $r = MP2 ? Apache2::RequestUtil->request : Apache->request;
40 4 my $key = "apache_singleton_$class";
41 4 $r->pnotes($key => $instance);
42 }
43  
44 2 1;
45  
46 __END__
« blib/lib/Apache/Singleton/Process.pm ↑ Summary