David Warring > Elive-1.30 > Elive::DAO::Singleton

Download:
Elive-1.30.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Source   Latest Release: Elive-1.32

NAME ^

Elive::DAO::Singleton - Singleton mixin class

DESCRIPTION ^

This mixin class provides a get method for fetching the singleton object. It also overrides the Elive::DAO list method, to return just the singleton object in a one element array.

Typical usage is:

    package Elive::Entity::SomeEntity;
    use warnings; use strict;

    use Mouse;

    extends 'Elive::DAO::Singleton', 'Elive::Entity';

METHODS ^

get

    my $server = Elive::Entity::ServerDetails->get(connection => $connection);

Gets the singleton object.

list

    my $server_list = Elive::Entity::SomeEntity->list();
    my $server_obj = $server_list->[0];

Returns the singleton object in a one element array .

syntax highlighting: