Test::Builder2::Singleton - A singleton role for TB2
package TB2::Thing; use Test::Builder2::Mouse; with 'Test::Builder2::Singleton'; my $thing = TB2::Thing->singleton; my $same_thing = TB2::Thing->singleton; my $new_thing = TB2::Thing->create;
FOR INTERNAL USE ONLY
A role implementing singleton for Test::Builder2 classes.
my $singleton = Class->singleton; Class->singleton($singleton);
Gets/sets the singleton object.
If there is no singleton one will be created by calling create().
Because it is not clear if new() will make a new object or return a singleton (like Test::Builder does) new() will simply croak to force the user to make the decision.
my $obj = Class->create(@args);
Creates a new, non-singleton object.
Currently calls Mouse's new method.
To install Test::Simple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Simple
CPAN shell
perl -MCPAN -e shell install Test::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.