SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG
DONATE


YUM REPOSITORY

 
 

MAN page from Fedora 28 perl-MooseX-Singleton-0.30-5.fc28.noarch.rpm

MooseX::Singleton

Section: User Contributed Perl Documentation (3pm)
Updated: 2016-11-23
Index 

NAME

MooseX::Singleton - Turn your Moose class into a singleton 

VERSION

version 0.30 

SYNOPSIS

    package MyApp;    use MooseX::Singleton;    has env => (        is      => 'rw',        isa     => 'HashRef[Str]',        default => sub { \%ENV },    );    package main;    delete MyApp->env->{PATH};    my $instance = MyApp->instance;    my $same = MyApp->instance;
 

DESCRIPTION

A singleton is a class that has only one instance in an application."MooseX::Singleton" lets you easily upgrade (or downgrade, as it were) yourMoose class to a singleton.

All you should need to do to transform your class is to change "use Moose" to"use MooseX::Singleton". This module uses metaclass roles to do its magic, soit should cooperate with most other "MooseX" modules. 

METHODS

A singleton class will have the following additional methods: 

Singleton->instance

This returns the singleton instance for the given package. This method doesnot accept any arguments. If the instance does not yet exist, it is createdwith its defaults values. This means that if your singleton requiresarguments, calling "instance" will die if the object has not already beeninitialized. 

Singleton->initialize(%args)

This method can be called only once per class. It explicitly initializesthe singleton object with the given arguments. 

Singleton->_clear_instance

This clears the existing singleton instance for the class. Obviously, this ismeant for use only inside the class itself. 

Singleton->new

This method currently works like a hybrid of "initialize" and"instance". However, calling "new" directly will probably be deprecated in afuture release. Instead, call "initialize" or "instance" as appropriate. 

SOME CODE STOLEN FROM

Anders Nor Berle <debolazAATTgmail.com> 

AND PATCHES FROM

Ricardo SIGNES <rjbsAATTcpan.org> 

SUPPORT

Bugs may be submitted through the RT bug tracker <https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Singleton>(or bug-MooseX-Singleton@rt.cpan.org <mailto:bug-MooseX-SingletonAATTrt.cpan.org>).

There is also a mailing list available for users of this distribution, at<http://lists.perl.org/list/moose.html>.

There is also an irc channel available for users of this distribution, at"#moose" on "irc.perl.org" <irc://irc.perl.org/#moose>. 

AUTHOR

Shawn M Moore <codeAATTsartak.org> 

CONTRIBUTORS

*
Dave Rolsky <autarchAATTurth.org>
*
Karen Etheridge <etherAATTcpan.org>
*
Ricardo SIGNES <rjbsAATTcpan.org>
*
Kaare Rasmussen <kaareAATTjasonic.dk>
*
Anders Nor Berle <berleAATTcpan.org>
*
Jonathan Rockway <jonAATTjrock.us>
*
Hans Dieter Pearcey <hdpAATTweftsoar.net>
 

COPYRIGHT AND LICENSE

This software is copyright (c) 2007 by Shawn M Moore.

This is free software; you can redistribute it and/or modify it underthe same terms as the Perl 5 programming language system itself.


 

Index

NAME
VERSION
SYNOPSIS
DESCRIPTION
METHODS
Singleton->instance
Singleton->initialize(%args)
Singleton->_clear_instance
Singleton->new
SOME CODE STOLEN FROM
AND PATCHES FROM
SUPPORT
AUTHOR
CONTRIBUTORS
COPYRIGHT AND LICENSE

This document was created byman2html,using the manual pages.