From 35795ab65c8a60d10581f307563034835252689a Mon Sep 17 00:00:00 2001 From: Matthias Bethke Date: Tue, 21 Jul 2015 15:02:16 +0700 Subject: [PATCH] make _escape_argument() readonly-safe on older Perls --- bindings/perl/lib/Collectd/Unixsock.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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. -- 2.11.0