From: Matthias Bethke Date: Tue, 21 Jul 2015 08:02:16 +0000 (+0700) Subject: make _escape_argument() readonly-safe on older Perls X-Git-Tag: collectd-5.6.0~617^2 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=35795ab65c8a60d10581f307563034835252689a;p=collectd.git make _escape_argument() readonly-safe on older Perls --- diff --git a/bindings/perl/lib/Collectd/Unixsock.pm b/bindings/perl/lib/Collectd/Unixsock.pm index 5c6a5f9d..69c755b6 100644 --- a/bindings/perl/lib/Collectd/Unixsock.pm +++ b/bindings/perl/lib/Collectd/Unixsock.pm @@ -137,13 +137,13 @@ sub _parse_identifier sub _escape_argument { - local $_ = shift; + my $arg = shift; - return $_ if /^\w+$/; + return $arg if $arg =~ /^\w+$/; - s#\\#\\\\#g; - s#"#\\"#g; - return "\"$_\""; + $arg =~ s#\\#\\\\#g; + $arg =~ s#"#\\"#g; + return "\"$arg\""; } # Send a command on a socket, including any required argument escaping.