aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/IRC/Client.pm616
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/IRC/Client.pm6 b/lib/IRC/Client.pm6
index cd23b73..3291474 100644
--- a/lib/IRC/Client.pm6
+++ b/lib/IRC/Client.pm6
@@ -20,11 +20,17 @@ has Lock $!lock = Lock.new;
has Channel $!event-pipe = Channel.new;
has Channel $!socket-pipe = Channel.new;
-my &colored = try {
- require Terminal::ANSIColor;
- &colored
- = GLOBAL::Terminal::ANSIColor::EXPORT::DEFAULT::<&colored>;
-} // sub (Str $s, $) { $s };
+my &colored = get-colored;
+&colored //= sub (Str $s, $) { $s };
+
+sub get-colored {
+ my &colored;
+ try {
+ require Terminal::ANSIColor;
+ &colored = GLOBAL::Terminal::ANSIColor::EXPORT::DEFAULT::<&colored>;
+ }
+ &colored;
+}
submethod BUILD (
Int:D :$!debug = 0,