[libnet-openid-common-perl] 03/05: remove use of $&

gregor herrmann gregoa at debian.org
Sun Feb 7 21:50:20 UTC 2016


This is an automated email from the git hooks/post-receive script.

gregoa pushed a commit to annotated tag v1.030099_002
in repository libnet-openid-common-perl.

commit 1258e855ea50c84983a02c5ab04b62ea90cd3e51
Author: Robert Norris <rob at eatenbyagrue.org>
Date:   Tue Dec 7 10:54:32 2010 +1100

    remove use of $&
---
 Changes                  |  2 ++
 lib/Net/OpenID/Common.pm |  2 +-
 t/07-ejs.t               | 13 +++++++++++++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/Changes b/Changes
index aa0c52e..b41c527 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,8 @@
 {{$NEXT}}
 
     * Documentation tweaks (Robert Norris)
+    
+    * Remove use of $& (Jess Robinson RT#63684)
 
 1.030099_001 Nov 06 2010
 
diff --git a/lib/Net/OpenID/Common.pm b/lib/Net/OpenID/Common.pm
index a938624..bcb8ed4 100644
--- a/lib/Net/OpenID/Common.pm
+++ b/lib/Net/OpenID/Common.pm
@@ -69,7 +69,7 @@ sub parse_keyvalue {
 sub ejs
 {
     my $a = $_[0];
-    $a =~ s/[\"\'\\]/\\$&/g;
+    $a =~ s/([\"\'\\])/\\$1/g;
     $a =~ s/\r?\n/\\n/gs;
     $a =~ s/\r//;
     return $a;
diff --git a/t/07-ejs.t b/t/07-ejs.t
new file mode 100644
index 0000000..9752b70
--- /dev/null
+++ b/t/07-ejs.t
@@ -0,0 +1,13 @@
+#!/usr/bin/perl
+    
+use strict;
+use Test::More 'no_plan';
+use Net::OpenID::Common;
+
+my @escapes = qw(
+    "'\\    \"\'\\\\
+);
+
+while ( my ($before, $after) = splice @escapes, 0, 2 ) {
+    is ( $after, OpenID::util::ejs($before) );
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libnet-openid-common-perl.git



More information about the Pkg-perl-cvs-commits mailing list