Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Singleton in Moose

MooseX::Singleton;

A game - the main class or the board is a singleton

Configuration

Database access

use strict;
use warnings;

use Test::More;
plan tests => 2;

use Games::Spacefight;

my $game = Games::Spacefight->new;
isa_ok($game, 'Games::Spacefight');

my $game2 = Games::Spacefight->new;
is $game2, $game, 'Singleton';


package Games::Spacefight;
use Moose;
use MooseX::Singleton;

1;