File Coverage

lib/Apache/Singleton/Request.pm
Criterion Covered Total %
statement 20 20 100.0
branch 2 2 100.0
condition n/a
subroutine 7 7 100.0
pod n/a
total 29 29 100.0


line stmt bran cond sub pod time code
1             package Apache::Singleton::Request;
2             BEGIN {
3 2     2   105058 $Apache::Singleton::Request::VERSION = '0.15';
4             }
5              
6             # ABSTRACT: One instance per One Request
7              
8 2     2   18 use strict;
  2         5  
  2         58  
9 2     2   10 use base 'Apache::Singleton';
  2         4  
  2         835  
10              
11             BEGIN {
12 2 100   2   12 use constant MP2 => $mod_perl::VERSION >= 1.99 ? 1 : 0;
  2         3  
  2         298  
13              
14 2     2   5 if (MP2) {
15             require Apache2::RequestUtil;
16             }
17             else {
18 2         901 require Apache;
19             }
20             }
21              
22             sub _get_instance {
23 8     8   16 my $class = shift;
24 8         39 my $r = MP2 ? Apache2::RequestUtil->request : Apache->request;
25 8         47 my $key = "apache_singleton_$class";
26 8         29 return $r->pnotes($key);
27             }
28              
29             sub _set_instance {
30 4     4   11 my($class, $instance) = @_;
31 4         11 my $r = MP2 ? Apache2::RequestUtil->request : Apache->request;
32 4         7687 my $key = "apache_singleton_$class";
33 4         23 $r->pnotes($key => $instance);
34             }
35              
36             1;
37              
38              
39              
40             =pod
41              
42             =head1 NAME
43              
44             Apache::Singleton::Request - One instance per One Request
45              
46             =head1 VERSION
47              
48             version 0.15
49              
50             =head1 SYNOPSIS
51              
52             # in httpd.conf
53             PerlOptions +GlobalRequest
54              
55             # in your module (e.g.: Printer.pm)
56             package Printer;
57             use base qw(Apache::Singleton::Request);
58              
59             =head1 DESCRIPTION
60              
61             See L.
62              
63             =head1 SEE ALSO
64              
65             L
66              
67             =head1 SOURCE
68              
69             The development version is on github at L
70             and may be cloned from L
71              
72             =head1 BUGS
73              
74             Please report any bugs or feature requests to bug-apache-singleton@rt.cpan.org or through the web interface at:
75             http://rt.cpan.org/Public/Dist/Display.html?Name=Apache-Singleton
76              
77             =head1 AUTHOR
78              
79             Michael Schout
80              
81             =head1 COPYRIGHT AND LICENSE
82              
83             This software is copyright (c) 2009 by Michael Schout.
84              
85             This is free software; you can redistribute it and/or modify it under
86             the same terms as the Perl 5 programming language system itself.
87              
88             =cut
89              
90              
91             __END__