[Rt-commit] r9122 - rt/branches/3.6-RELEASE/bin

sunnavy at bestpractical.com sunnavy at bestpractical.com
Sun Sep 23 00:34:33 EDT 2007


Author: sunnavy
Date: Sun Sep 23 00:34:33 2007
New Revision: 9122

Modified:
   rt/branches/3.6-RELEASE/bin/rt.in

Log:
updated vsplit in accordance with our change to multiple value CF

Modified: rt/branches/3.6-RELEASE/bin/rt.in
==============================================================================
--- rt/branches/3.6-RELEASE/bin/rt.in	(original)
+++ rt/branches/3.6-RELEASE/bin/rt.in	Sun Sep 23 00:34:33 2007
@@ -59,6 +59,7 @@
 use Text::ParseWords;
 use HTTP::Request::Common;
 use Term::ReadLine;
+use Text::Balanced qw/extract_quotelike/;
 
 # We derive configuration information from hardwired defaults, dotfiles,
 # and the RT* environment variables (in increasing order of precedence).
@@ -1327,11 +1328,36 @@
     my ($word, @words);
     my @values = ref $val eq 'ARRAY' ? @$val : $val;
 
-    foreach my $line (map {split /\n/} @values) {
-        # XXX: This should become a real parser, à la Text::ParseWords.
+    foreach my $line ( map { split /\n/ } @values ) {
         $line =~ s/^\s+//;
         $line =~ s/\s+$//;
-        push @words, split /\s*,\s*/, $line;
+        my ( $extracted, $remainder ) = extract_quotelike($line);
+        while ($remainder) {
+            if ($extracted) {
+                if ( $extracted =~ /^q{/ ) {
+                    $extracted =~ s/'/\\'/g;
+                    $extracted =~ s/^q{/'/;
+                    $extracted =~ s/}$/'/;
+                }
+                push @words, $extracted;
+                $remainder =~ s/^\s*,\s*//;
+            }
+            else {
+                my @t = split /,/, $remainder;
+                push @words, shift @t;
+                last unless @t;
+                $remainder =~ s/.*?,\s*//;
+            }
+            ( $extracted, $remainder ) = extract_quotelike($remainder);
+        }
+        if ( $extracted ) {
+            if ( $extracted =~ /^q{/ ) {
+                $extracted =~ s/'/\\'/g;
+                $extracted =~ s/^q{/'/;
+                $extracted =~ s/}$/'/;
+            }
+            push @words, $extracted;
+        }
     }
 
     return \@words;


More information about the Rt-commit mailing list