Hyper::Singleton - base class which implements the singleton design pattern
This document describes Hyper::Singleton 0.01
package Hyper::Singleton::Sample; use Class::Std::Storable; use base qw(Hyper::Singleton); 1; my $instance_1 = Hyper::Singleton::Sample->singleton(); my $instance_2 = Hyper::Singleton::Sample->singleton(); ref $instance_1 eq ref $instance_2;
Hyper::Singleton gives the inheriting class the singleton method, which is used to get only one object of this class on every call.
my $new_instance = Hyper::Singleton::Debug->new();
Create a new Object instance.
my $instance = Hyper::Singleton::Sample->singleton();
Get the object as singleton.
$self->_init_singleton();
Initializes the singleton and stores it to our global vars.
my $existant_instance = $self->_get_singleton();
Get existant instance of the singleton object.
my $r = $self->_get_request_object();
Get the apache request object in mod perl environments.
my $identifier = $self->_get_identifier();
Reinitialize our object on thaw.
version
Class::Std::Storable
Apache2::RequestUtil
Apache::RequestUtil
$Author: ac0v $
$Id: Singleton.pm 351 2008-04-08 10:17:43Z ac0v $
$Revision: 351 $
$Date: 2008-04-08 12:17:43 +0200 (Di, 08 Apr 2008) $
$HeadURL: http://svn.hyper-framework.org/Hyper/Hyper/tags/0.05/lib/Hyper/Singleton.pm $
Andreas Specht <ACID@cpan.org>
<ACID@cpan.org>
Copyright (c) 2007, Andreas Specht <ACID@cpan.org>. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Hyper, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Hyper
CPAN shell
perl -MCPAN -e shell install Hyper
For more information on module installation, please visit the detailed CPAN module installation guide.