Hyper::Singleton - base class which implements the singleton design pattern


Back to Top


NAME

Hyper::Singleton - base class which implements the singleton design pattern

Back to Top


VERSION

This document describes Hyper::Singleton 0.01

Back to Top


SYNOPSIS

    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;

Back to Top


DESCRIPTION

Hyper::Singleton gives the inheriting class the singleton method, which is used to get only one object of this class on every call.

Back to Top


SUBROUTINES/METHODS

BUILD

    my $new_instance = Hyper::Singleton::Debug->new();

Create a new Object instance.

singleton

    my $instance = Hyper::Singleton::Sample->singleton();

Get the object as singleton.

_init_singleton :PRIVATE

    $self->_init_singleton();

Initializes the singleton and stores it to our global vars.

_get_singleton :PRIVATE

    my $existant_instance = $self->_get_singleton();

Get existant instance of the singleton object.

_get_request_object :PRIVATE

    my $r = $self->_get_request_object();

Get the apache request object in mod perl environments.

_get_identifier :PRIVATE

    my $identifier = $self->_get_identifier();

Get the apache request object in mod perl environments.

STORABLE_thaw_post :CUMULATIVE

Reinitialize our object on thaw.

Back to Top


DIAGNOSTICS

Back to Top


CONFIGURATION AND ENVIRONMENT

Back to Top


DEPENDENCIES

Back to Top


INCOMPATIBILITIES

Back to Top


BUGS AND LIMITATIONS

Back to Top


RCS INFORMATIONS

Last changed by

$Author: ac0v $

Id

$Id: Singleton.pm 351 2008-04-08 10:17:43Z ac0v $

Revision

$Revision: 351 $

Date

$Date: 2008-04-08 12:17:43 +0200 (Di, 08 Apr 2008) $

HeadURL

$HeadURL: http://svn.hyper-framework.org/Hyper/Hyper/tags/0.05/lib/Hyper/Singleton.pm $

Back to Top


AUTHOR

Andreas Specht <ACID@cpan.org>

Back to Top


LICENSE AND COPYRIGHT

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.

Back to Top

 Hyper::Singleton - base class which implements the singleton design pattern