2

Issue: Unrecognized escape \m passed through in regex; marked by <-- HERE in m/.*?/ at ./build.pl line 890.

856 sub addProperity {
857 
858     my ($line,$inprop,$newpom,$depver,$artifactId,$thisartifactId,$br,$paramvalue,$masterpomversion) = @_;
859 
860     my $alllines;
861 
862     if ( $$inprop ) {
863 
864             (my $thisline = $line) =~ s!\r!!;
865             chomp $thisline;
866 
867             $thisline =~ s%<!--.*?-->%%g;
868             $thisline =~ s%<!--.*%%;
869             $thisline =~ s%.*-->%%;
870 
871             $$inprop = '' if ( $thisline =~ m!</properties>! );
872             $thisline =~ s%<.{0,1}properties>%%g;
873             $thisline =~ s%\s*$%%;
874 
875             while ( $thisline ) {
876                 #print "thisline=$thisline"."XX\n";
877                 ( my $propname = $thisline ) =~ s!\s*<(.*?)>.*!$1!;
878                 if ( $propname =~ m!.group\s*! ) {
879 
880                 (my $propvalue = $thisline ) =~ s!.*<$propname>(.*?)</$propname>.*!$1!;
881                 if ( $propvalue =~ /\s*com.alcatel.axs.(.*)\s*/ ) {
882 
883                     my $groupId=$1;
884                     my $thisversion=getThisVersion($depver,$groupId,$artifactId,$thisartifactId,$br,$paramvalue,$masterpomversion);
885                     push ( @{$newpom}, '<'.$propname.'.repversion>'.$thisversion.'</'.$propname.'.repversion>'."\n");
886                 }
887             }
888 
889             my $currentline=$thisline;
890             $thisline =~ s!.*?</$propname>!!;
891             last if ($currentline=$thisline);
892         }
893     }
894 }

Background:

The script was working fine on - Perl v5.8.8 built for i386-linux-thread-multi, but

Not working on Perl - v5.10.1 (*) built for x86_64-linux-thread-multi

4

1 回答 1

6

问题只是其中的字符串$propname包含字符\m

如果你真的想包含一个反斜杠(我猜不是因为它看起来像你正在使用 XML 标签)那么你需要编写

$thisline =~ s!.*?</\Q$propname\E>!!

转义变量中的任何元字符

于 2012-08-04T19:58:22.100 回答