Kevin Treleaven > Anansi-Singleton > Anansi::Singleton

Download:
Anansi-Singleton-0.08.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.08   Source  

NAME ^

Anansi::Singleton - A base module definition where only a single object instance is allowed.

SYNOPSIS ^

    package Anansi::Example;

    use base qw(Anansi::Singleton);

    sub finalise {
        my ($self, %parameters) = @_;
    }

    sub fixate {
        my ($self, %parameters) = @_;
    }

    sub initialise {
        my ($self, %parameters) = @_;
    }

    sub reinitialise {
        my ($self, %parameters) = @_;
    }

    1;

    package main;

    use Anansi::Example;

    my $object = Anansi::Example->new();

    1;

DESCRIPTION ^

This is a base module definition that manages the creation and destruction of module object instances that are not repeatable including embedded objects and ensures that destruction can only occur when all duplicate object instances are no longer used. Uses Anansi::Class, Anansi::ObjectManager and base.

METHODS ^

Anansi::Class

See Anansi::Class for details. A parent module of Anansi::Singleton.

DESTROY

See Anansi::Class::DESTROY for details. Overridden by Anansi::Singleton::DESTROY.

finalise

See Anansi::Class::finalise for details. A virtual method.

implicate

See Anansi::Class::implicate for details. A virtual method.

import

See Anansi::Class::import for details.

initialise

See Anansi::Class::initialise for details. A virtual method.

new

See Anansi::Class::new for details. Overridden by Anansi::Singleton::new.

old

See Anansi::Class::old for details.

used

See Anansi::Class::used for details.

uses

See Anansi::Class::uses for details.

using

See Anansi::Class::using for details.

DESTROY

self (Blessed Hash, Required)

An object of this namespace.

Overrides Anansi::Class::DESTROY. Performs module object instance clean-up actions. Either calls the fixate method prior to dereferencing an instance of the object where more than one instance exists or the finalise method prior to dereferencing the last instance. Indirectly called by the perl interpreter.

fixate

    $OBJECT->fixate();

    $OBJECT->SUPER::fixate();
self (Blessed Hash, Required)

An object of this namespace.

parameters (Hash, Optional)

Named parameters.

A virtual method. Called just prior to module instance object destruction where there are multiple instances of the object remaining.

new

    my $object = Anansi::Example->new();
    my $object = Anansi::Example->new(
        SETTING => 'example',
    );
class (Blessed Hash or String, Required)

Either an object or a string of this namespace.

parameters (Hash, Optional)

Named parameters.

Overrides Anansi::Class::new. Instantiates or reinstantiates an object instance of a module. Either calls the initialise method with the supplied parameters after the object is first instantiated or the reinitialise method after subsequent instantiations.

reinitialise

    $OBJECT->reinitialise();

    $OBJECT->SUPER::reinitialise();
self (Blessed Hash, Required)

An object of this namespace.

parameters (Hash, Optional)

Named parameters.

A virtual method. Called just after module instance object recreation.

NOTES ^

This module is designed to make it simple, easy and quite fast to code your design in perl. If for any reason you feel that it doesn't achieve these goals then please let me know. I am here to help. All constructive criticisms are also welcomed.

AUTHOR ^

Kevin Treleaven <kevin AT treleaven DOT net>

syntax highlighting: