The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Class::SingletonProxy - proxy class methods to a singleton

SYNOPSIS

package Foo;
use base Class::SingletonProxy;

sub SINGLETON {
    return Foo::Impl->new();
}

package main;

Foo->hello;
Foo->bar(1234);

DESCRIPTION

classes derived from Class::SingletonProxy redirect class methods to (per class) singleton objects.

METHODS

$class->SINGLETON()

this method can be redefined on subclasses and is automatically called to create the singleton when it has not been previously defined.

$class->singleton()
$class->singleton($singleton)

gets/sets the class singleton object.

COPYRIGHT AND LICENSE

Copyright (C) 2005 by Salvador Fandiño <sfandino@yahoo.com>.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.