aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoffix Znet <zoffixznet@users.noreply.github.com>2016-07-30 09:54:53 -0400
committerGitHub <noreply@github.com>2016-07-30 09:54:53 -0400
commit9a6ef7baf2fa7a182e9cb2754394d6affdc684e0 (patch)
treeabb4670bc34c19ce6a6a22234f5b6f8617045e96
parentaf8ff47de129c57dac93defe4a92d44fedcc55fd (diff)
parent4f3d80a0d05d02658dec32ec079d94261ea48d08 (diff)
Merge pull request #16 from MasterDuke17/master
Fix for precompilation problems when requiring inside of a try
-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,