aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoffix Znet <zoffixznet@users.noreply.github.com>2018-08-30 08:02:16 -0400
committerGitHub <noreply@github.com>2018-08-30 08:02:16 -0400
commitf319378a4dcaadd98fb5837074bd0b77625308b4 (patch)
treee610320090aa2eeb02425b10f1a23fa78a6dce6c
parentee85c330349621320c97acd53bc9c42d7ceaad45 (diff)
Speed up arg quoting and search for all whitespace
-rw-r--r--lib/IRC/Client.pm66
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/IRC/Client.pm6 b/lib/IRC/Client.pm6
index 46832af..dec288f 100644
--- a/lib/IRC/Client.pm6
+++ b/lib/IRC/Client.pm6
@@ -357,7 +357,11 @@ method send-cmd ($cmd, *@args is copy, :$prefix = '', :$server) {
}
}
else {
- @args[*-1] = ':' ~ @args[*-1] if @args && @args[*-1] ~~ / ^':' | ' ' | ^$ /;
+ if @args {
+ my $last := @args[*-1];
+ $last = ':' ~ $last
+ if not $last or $last.starts-with: ':' or $last.match: /\s/;
+ }
self!ssay: :$server, join ' ', $cmd, @args;
}
}