From: <de...@de...> - 2012-11-30 05:34:31
|
Author: PeterThoeny Date: 2012-11-29 23:34:25 -0600 (Thu, 29 Nov 2012) New Revision: 24238 Trac url: http://develop.twiki.org/trac/changeset/24238 Modified: twiki/trunk/core/lib/TWiki/Configure/Types/REGEX.pm twiki/trunk/core/lib/TWiki/Configure/Valuer.pm Log: Item7067: Fix for configure adding extra (?^: ... ) to regex variables on save under Perl 5.14 Modified: twiki/trunk/core/lib/TWiki/Configure/Types/REGEX.pm =================================================================== --- twiki/trunk/core/lib/TWiki/Configure/Types/REGEX.pm 2012-11-30 05:34:06 UTC (rev 24237) +++ twiki/trunk/core/lib/TWiki/Configure/Types/REGEX.pm 2012-11-30 05:34:25 UTC (rev 24238) @@ -27,19 +27,31 @@ use base 'TWiki::Configure::Types::STRING'; +# TWikibug:Item7067: Configure adds extra (?^:) to regex variables +# on save under Perl 5.14. This needs to be cleaned up. +# SMELL: Regex cleanup needs to be done on 3 places: +# * Here in sub string2value, +# * Here in sub equals, +# * TWiki::Configure::Valuer in sub _getValue. + sub prompt { my( $this, $id, $opts, $value ) = @_; $value = '' unless defined($value); $value = "$value"; - while ($value =~ s/^\(\?-xism:(.*)\)$/$1/) { }; - $value =~ s/([[\x01-\x09\x0b\x0c\x0e-\x1f"%&'*<=>@[_\|])/'&#'.ord($1).';'/ge; + + # Disabling this because the value should not appears changed in the authorise screen + # while ( $value =~ s/^\(\?-xism:(.*)\)$/$1/ ) { } + # while ( $value =~ s/^\(\?\^:(.*)\)/$1/ ) { } + # $value =~ s/([[\x01-\x09\x0b\x0c\x0e-\x1f"%&'*<=>@[_\|])/'&#'.ord($1).';'/ge; + my $res = '<input name="'.$id.'" type="text" size="55%" value="'.$value.'" />'; return $res; } sub string2value { my ($this, $value) = @_; - while ($value =~ s/^\(\?-xism:(.*)\)$/$1/) { }; + while ( $value =~ s/^\(\?-xism:(.*)\)$/$1/ ) { } + while ( $value =~ s/^\(\?\^:(.*)\)/$1/ ) { } return qr/$value/; } @@ -51,10 +63,10 @@ } elsif (!defined $def) { return 0; } - while ($val =~ s/^\(\?-xism:(.*)\)$/$1/) { - } - while ($def =~ s/^\(\?-xism:(.*)\)$/$1/) { - } + while ( $val =~ s/^\(\?-xism:(.*)\)$/$1/ ) { } + while ( $def =~ s/^\(\?-xism:(.*)\)$/$1/ ) { } + while ( $val =~ s/^\(\?\^:(.*)\)/$1/ ) { } + while ( $def =~ s/^\(\?\^:(.*)\)/$1/ ) { } return $val eq $def; } Modified: twiki/trunk/core/lib/TWiki/Configure/Valuer.pm =================================================================== --- twiki/trunk/core/lib/TWiki/Configure/Valuer.pm 2012-11-30 05:34:06 UTC (rev 24237) +++ twiki/trunk/core/lib/TWiki/Configure/Valuer.pm 2012-11-30 05:34:25 UTC (rev 24238) @@ -54,7 +54,15 @@ # SMELL: Really shouldn't do this unless we are sure it's an RE, # but the probability of this string occurring elsewhere than an # RE is so low that we can afford to take the risk. - while ($val =~ s/^\(\?-xism:(.*)\)$/$1/) {}; + + # TWikibug:Item7067: Configure adds extra (?^:) to regex variables + # on save under Perl 5.14. This needs to be cleaned up. + # SMELL: Regex cleanup needs to be done on 3 places: + # * TWiki::Configure::Types::REGEX in sub string2value, + # * TWiki::Configure::Types::REGEX in sub equals, + # * Here in sub _getValue. + while ( $val =~ s/^\(\?-xism:(.*)\)$/$1/ ) { } + while ( $val =~ s/^\(\?\^:(.*)\)$/$1/ ) { } } return $val; } |