From 2674cfd2e9ff7a8b4f2952a5f84e94804afc3a1f Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 29 Dec 2012 01:06:47 -0600 Subject: add a bit more api to the singleton instance --- lib/Bread/Board.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/Bread/Board.pm') diff --git a/lib/Bread/Board.pm b/lib/Bread/Board.pm index 82b886c..c741757 100644 --- a/lib/Bread/Board.pm +++ b/lib/Bread/Board.pm @@ -406,15 +406,20 @@ class Container does Traversable { role Singleton does Lifecycle is export { has $!instance; - has Bool $!has_instance; + has Bool $.has_instance; method get { - if !$!has_instance { + if !$.has_instance { $!instance = callsame; $!has_instance = True; } return $!instance; } + + method flush_instance { + $!instance = Any; + $!has_instance = False; + } } our $CC; -- cgit v1.2.3-54-g00ecf