Skip to content

Commit

Permalink
Merge pull request #16 from MasterDuke17/master
Browse files Browse the repository at this point in the history
Fix for precompilation problems when requiring inside of a try
  • Loading branch information
zoffixznet authored Jul 30, 2016
2 parents af8ff47 + 4f3d80a commit 9a6ef7b
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lib/IRC/Client.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 9a6ef7b

Please sign in to comment.