[Rt-commit] rt branch, 3.8/perlcritic, updated. rt-3.8.10-202-g1defe38

Alex Vandiver alexmv at bestpractical.com
Thu Aug 18 17:53:31 EDT 2011


The branch, 3.8/perlcritic has been updated
       via  1defe38aa91b42656c77e54f9fc058e3c66a20aa (commit)
      from  0f6db7130b5b3dd78115aa84195dc99aa353e109 (commit)

Summary of changes:
 sbin/extract-message-catalog |   37 ++++++++++++++++++-------------------
 1 files changed, 18 insertions(+), 19 deletions(-)

- Log -----------------------------------------------------------------
commit 1defe38aa91b42656c77e54f9fc058e3c66a20aa
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Aug 18 17:27:52 2011 -0400

    Remove use of $& and cryptocontext
    
    This also fixes a bug in the reported line number of <&|l&>...</&> blocks

diff --git a/sbin/extract-message-catalog b/sbin/extract-message-catalog
index 9b3e64b..225e97f 100755
--- a/sbin/extract-message-catalog
+++ b/sbin/extract-message-catalog
@@ -145,10 +145,10 @@ sub extract_strings_from_code {
 
     # Mason filter: <&|/l>...</&>
     my $line = 1;
-    while (m!\G.*?<&\|/l(.*?)&>(.*?)</&>!sg) {
-        my ( $vars, $str ) = ( $1, $2 );
+    while (m!\G(.*?<&\|/l(.*?)&>(.*?)</&>)!sg) {
+        my ( $all, $vars, $str ) = ( $1, $2, $3 );
         $vars =~ s/[\n\r]//g;
-        $line += ( () = ( $& =~ /\n/g ) );    # cryptocontext!
+        $line += ( $all =~ tr/\n/\n/ );
         $str =~ s/\\'/\'/g;
         #print "STR IS $str\n";
         push @{ $FILECAT->{$str} }, [ $filename, $line, $vars ];
@@ -157,9 +157,9 @@ sub extract_strings_from_code {
     # Localization function: loc(...)
     $line = 1;
     pos($_) = 0;
-    while (m/\G.*?\bloc$RE{balanced}{-parens=>'()'}{-keep}/sg) {
-        my $match = $1;
-        $line += ( () = ( $& =~ /\n/g ) );    # cryptocontext!
+    while (m/\G(.*?\bloc$RE{balanced}{-parens=>'()'}{-keep})/sg) {
+        my ( $all, $match ) = ( $1, $2 );
+        $line += ( $all =~ tr/\n/\n/ );
 
         my ( $vars, $str );
         if ( $match =~
@@ -181,9 +181,9 @@ sub extract_strings_from_code {
     # Comment-based mark: "..." # loc
     $line = 1;
     pos($_) = 0;
-    while (m/\G.*?($re_delim)[\}\)\],;]*$re_loc_suffix/smgo) {
-	my $str = $1;
-	$line += ( () = ( $& =~ /\n/g ) );    # cryptocontext!
+    while (m/\G(.*?($re_delim)[\}\)\],;]*$re_loc_suffix)/smgo) {
+        my ( $all, $str ) = ( $1, $2 );
+        $line += ( $all =~ tr/\n/\n/ );
         unless ( defined $str ) {
             warn "Couldn't process loc at $filename:$line";
             next;
@@ -196,9 +196,9 @@ sub extract_strings_from_code {
     # Comment-based qw mark: "qw(...)" # loc_qw
     $line = 1;
     pos($_) = 0;
-    while (m/\G.*?(?:qw\(([^)]+)\)[\}\)\],;]*)?$re_loc_qw_suffix/smgo) {
-        my $str = $1;
-	$line += ( () = ( $& =~ /\n/g ) );    # cryptocontext!
+    while (m/\G(.*?(?:qw\(([^)]+)\)[\}\)\],;]*)?$re_loc_qw_suffix)/smgo) {
+        my ( $all, $str ) = ( $1, $2 );
+        $line += ( $all =~ tr/\n/\n/ );
         unless ( defined $str ) {
             warn "Couldn't process loc_qw at $filename:$line";
             next;
@@ -211,9 +211,9 @@ sub extract_strings_from_code {
     # Comment-based left pair mark: "..." => ... # loc_left_pair
     $line = 1;
     pos($_) = 0;
-    while (m/\G.*?(?:(\w+)\s*=>[^#\n]+?)?$re_loc_left_pair_suffix/smgo) {
-	my $key = $1;
-	$line += ( () = ( $& =~ /\n/g ) );    # cryptocontext!
+    while (m/\G(.*?(?:(\w+)\s*=>[^#\n]+?)?$re_loc_left_pair_suffix)/smgo) {
+        my ( $all, $key ) = ( $1, $2 );
+        $line += ( $all =~ tr/\n/\n/ );
         unless ( defined $key ) {
             warn "Couldn't process loc_left_pair at $filename:$line";
             next;
@@ -225,10 +225,9 @@ sub extract_strings_from_code {
     # Comment-based pair mark: "..." => "..." # loc_pair
     $line = 1;
     pos($_) = 0;
-    while (m/\G.*?(?:(\w+)\s*=>\s*($re_delim)[\}\)\],;]*)?$re_loc_pair_suffix/smgo) {
-	my $key = $1;
-	my $val = $2;
-	$line += ( () = ( $& =~ /\n/g ) );    # cryptocontext!
+    while (m/\G(.*?(?:(\w+)\s*=>\s*($re_delim)[\}\)\],;]*)?$re_loc_pair_suffix)/smgo) {
+        my ( $all, $key, $val ) = ( $1, $2, $3 );
+        $line += ( $all =~ tr/\n/\n/ );
         unless ( defined $key && defined $val ) {
             warn "Couldn't process loc_pair at $filename:$line";
             next;

-----------------------------------------------------------------------


More information about the Rt-commit mailing list