root/Apache-Singleton/trunk/README

Revision 412 (checked in by miyagawa, 19 years ago)

version

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 NAME
2     Apache::Singleton - Singleton class for mod_perl
3
4 SYNOPSIS
5       package Printer;
6       # default:
7       #   Request for mod_perl env
8       #   Process for non-mod_perl env
9       use base qw(Apache::Singleton);
10
11       package Printer::PerRequest;
12       use base qw(Apache::Singleton::Request);
13
14       package Printer::PerProcess;
15       use base qw(Apache::Singleton::Process);
16
17 DESCRIPTION
18     Apache::Singleton works the same as Class::Singleton, but with various
19     object lifetime (scope). See the Class::Singleton manpage first.
20
21 OBJECT LIFETIME
22     By inheriting one of the following sublasses of Apache::Singleton, you
23     can change the scope of your object.
24
25     Request
26           use base qw(Apache::Singleton::Request);
27
28         One instance for one request. Apache::Singleton will remove instance
29         on each request. Implemented using mod_perl "pnotes" API. In
30         mod_perl environment (where $ENV{MOD_PERL} is defined), this is the
31         default scope, so inheriting from Apache::Singleton would do the
32         same effect.
33
34     Process
35           use base qw(Apache::Singleton::Process);
36
37         One instance for one httpd process. Implemented using package
38         global. In non-mod_perl environment, this is the default scope, and
39         you may notice this is the same beaviour with Class::Singleton ;)
40
41         So you can use this module safely under non-mod_perl environment.
42
43 AUTHOR
44     Original idea by Matt Sergeant <matt@sergeant.org> and Perrin Harkins
45     <perrin@elem.com>.
46
47     Code by Tatsuhiko Miyagawa <miyagawa@bulknews.net>.
48
49     This library is free software; you can redistribute it and/or modify it
50     under the same terms as Perl itself.
51
52 SEE ALSO
53     the Apache::Singleton::Request manpage, the Apache::Singleton::Process
54     manpage, the Class::Singleton manpage
55
Note: See TracBrowser for help on using the browser.