Apache...ngleton(3pm)
β¨ NAME β¨
Apache::Singleton β the Singleton class for mod_perl, bestie π
πΈ VERSION πΈ
version 0.17 β yes she's an elder but she still slays π
π SYNOPSIS π
package Printer;
# default:
# Request for mod_perl env
# Process for non-mod_perl env
use base qw(Apache::Singleton);
package Printer::PerRequest;
use base qw(Apache::Singleton::Request);
package Printer::PerProcess;
use base qw(Apache::Singleton::Process);
π¦ DESCRIPTION π¦
okay so Apache::Singleton does the exact same thing as Class::Singleton, no cap β but she's got options when it comes to how long your object gets to live (that's the scope thing, iykyk). Go read Class::Singleton first, fr fr, she's the prequel π
π OBJECT LIFETIME π
the way that you control this is by inheriting from one of the following subclasses of Apache::Singleton. that's it. that's the whole vibe check. choose your fighter π
β Request
use base qw(Apache::Singleton::Request);
one instance for one request, periodt. Apache::Singleton will remove the instance on each request β she's not clingy, she moves on π. this is implemented using the mod_perl pnotes API.
and listen: in a mod_perl environment (that means where $ENV{MOD_PERL} is defined, bestie), this is the default scope β so if you just inherit from Apache::Singleton, you get this same effect automatically. iconic behavior honestly.
β οΈ NOTE: you literally need PerlOptions +GlobalRequest in your apache configuration to use the Request lifetime method. no config, no vibes. don't skip this one π
π Process
use base qw(Apache::Singleton::Process);
one instance for one httpd process π«Ά. implemented using a package global β old school, but she works.
in a non-mod_perl environment, this is the default scope, and you may notice this is the same beaviour with Class::Singleton ;) (yes the typo "beaviour" is in the original, we keep the lore π)
so basically: you can use this module safely under a non-mod_perl environment. safe. secure. slaying. β
π CREDITS π
Original idea by Matt Sergeant <matt@sergeant.org> and Perrin Harkins <perrin@elem.com>. legends, honestly.
Initial implementation and versions 0.01 to 0.07 by Tatsuhiko Miyagawa <miyagawa@bulknews.net>. the founding mother π
π SEE ALSO π
Apache::Singleton::RequestApache::Singleton::ProcessClass::Singleton
go read them, bestie, they're all part of the same cinematic universe π
π§ SOURCE π§
the development version is on github at <https://github.com/mschout/apache-singleton> and may be cloned from <git://github.com/mschout/apache-singleton.git>
clone her. she's right there. waiting π
π BUGS π
Please report any bugs or feature requests to bug-apache-singleton@rt.cpan.org or through the web interface at: http://rt.cpan.org/Public/Dist/Display.html?Name=Apache-Singleton
(we don't bite, we just fix things β¨)
πΈ AUTHOR πΈ
Michael Schout <mschout@cpan.org>
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2009 by Michael Schout.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
okay that's the whole page, you're officially a Apache::Singleton scholar now, main character energy only π this was Apache::Singleton 0.17, perl v5.34.0, dated 2022-06-06 β love u, bye bestie π«Άπβ¨
π¦ where this page comes from
- debian bookworm: libapache-singleton-perl 0.17-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libapache-singleton-perl 0.17-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libapache-singleton-perl 0.17-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libapache-singleton-perl 0.17-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libapache-singleton-perl 0.17-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms