From 0979ac86d9e2d6bcb2a749457a8e8b99bcac2196 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Fri, 7 Jun 2019 13:56:41 -0700 Subject: [PATCH] Interpreter: split_line now accepts a parameter to strip quotes --- PBot/Interpreter.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/PBot/Interpreter.pm b/PBot/Interpreter.pm index e24d3729..1711acb0 100644 --- a/PBot/Interpreter.pm +++ b/PBot/Interpreter.pm @@ -546,7 +546,9 @@ sub extract_bracketed { # unbalanced quotes gracefully by treating them as part of the argument # they were found within. sub split_line { - my ($self, $line) = @_; + my ($self, $line, $strip_quotes) = @_; + + $strip_quotes = 0 if not defined $strip_quotes; my @chars = split //, $line; @@ -594,7 +596,7 @@ sub split_line { if (defined $quote) { if ($ch eq $quote) { # closing quote - $token .= $ch; + $token .= $ch unless $strip_quotes; push @args, $token; $quote = undef; $token = ''; @@ -614,7 +616,7 @@ sub split_line { # begin potential quoted argument $pos = $i - 1; $quote = $ch; - $token .= $ch; + $token .= $ch unless $strip_quotes; } next; }