MooX::Singleton(3pm)

MooX::Singleton3pm

Turn your moo class into singleton

Usage

    package MyApp;
    use Moo;
    with 'MooX::Singleton';
    package main;
    my $instance = MyApp->instance(@optional_init_args);
    my $same = MyApp->instance;

Version

version 1.20

Overview

Role::Tiny role that provides "instance" method turning your object into singleton.

Methods

instance

    my $singleton = MyApp->instance(@args1);
    my $same = MyApp->instance;
    # @args2 are ignored
    my $above = MyApp->instance(@args2);

Creates a new object initialized with arguments provided and then returns it.

NOTE: Subsequent calls to "instance" will return the singleton instance ignoring any arguments. This is different from MooseX::Singleton which does not allow any arguments.

Releases

6 releases since Debian 8 (Jessie); the text changed 3 times.

  1. 8
  2. 9–10
  3. 11
  4. 12–13

Author

Alex J. G. BurzyXski <[email protected]>

From libmoox-singleton-perl 1.20-3 in Debian 13 (Trixie). Parsed by carta from the page's man source.