MooX::Singleton(3pm)
π MooX::Singleton π
okay bestie, so this is MooX::Singleton β the Perl module that takes your cute little Moo class and makes it a singleton. one instance. one. that's the whole vibe. π
version 1.20 β yes she's been around, she's iconic, she's stable.
β¨ SYNOPSIS β¨
package MyApp;
use Moo;
with 'MooX::Singleton';
package main;
my $instance = MyApp->instance(@optional_init_args);
my $same = MyApp->instance;
like. look at her. with 'MooX::Singleton' and boom, you got yourself an instance. πΈ
π¦ DESCRIPTION π¦
so this is a Role::Tiny role, and what it does is hand you an instance method that turns your object into a singleton. that's it. that's the whole job. she's lowkey minimal and highkey perfect for it. π
π METHODS π
instance
my $singleton = MyApp->instance(@args1);
my $same = MyApp->instance;
# @args2 are ignored
my $above = MyApp->instance(@args2);
what she does: creates a new object initialized with the arguments you gave her, and then returns it. β¨
NOTE: subsequent calls toinstancewill return the singleton instance and ignore any arguments you pass. literally just ignore them. no cap. π this is different fromMooseX::Singleton, which doesn't allow any arguments at all. so like, different energy entirely. iykyk.
π AUTHOR π
Alex J. G. BurzyXski <ajgb@cpan.org>
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2012 by Alex J. G. BurzyXski <ajgb@cpan.org>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. π«Ά
and that's the whole page, bestie!! π this one's from perl v5.34.0, dated 2022-06-16, and it lives at MooX::Singleton(3pm). go make some singletons, you absolute main character. π§πβ¨
π¦ where this page comes from
- debian bookworm: libmoox-singleton-perl 1.20-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libmoox-singleton-perl 1.20-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libmoox-singleton-perl 1.20-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libmoox-singleton-perl 1.20-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmoox-singleton-perl 1.20-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms