[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

Re: [BUG REPORT] WML 1.7.2 and current CVS snapshot, SunOS 5.5.1

On Wed, 30 Jun 1999, Denis Barbier wrote:

> It's much more complicated :-(
> In all versions, spaces and quotes are invalid when defining variables.
> One problem is that command-line arguments are parsed by the shell
> whereas .wmlrc and shebang-line are parsed by Perl by something like
>     split(' ', $string);
> Then your example is split into 
>     -DFOO="moo
>     \"bar\""
> I have no solution, sorry.

I hate to be the know-nothing who just read The Perl Cookbook and now
thinks he's hot stuff, but isn't this essentially the same problem as the
'I have comma-delimited input but some of the fields have commas
surrounded by "" so those shouldn't be split on?"

The procedure shown in TPC is based on stuff from Mastering Regular
Expressions. Given that I am a loser I am not sure how to convert this to
be of use to you (ie do whitespace delims instead of commas), here is the
code in the book, modulo any typos I introduce. =)

sub parse_csv {
   my $text = shift;
   my @new = ();
   push(@new, $+) while $text =~ m{
      #the first part groups the phrase inside the quotes
      #see explanation of this pattern in MRE
         |   ([^,]+),?
         |   ,   
   push(@new, undef) if substr($text, -1, 1) eq ',';
   return @new;

it also has a note to check out the Text::ParseWords module which looks
like it takes a delim that you specify, and presumably also would handle
the cases of a quoted space or something.

Sorry if I'm being totally dense, I'll admit not even using wml lately let
alone ever having hacked into it. But if running that sort of
word-separator would get you what you want for the shebang and .wmlrc
options, and it seems easy enough to get spaces into the shell-parsed
arguments, then the no-spaces restriction could be lefted?



The Microsoft/Mindcraft/ZDNet benchmarks:
     a) prove Linux is faster than you will ever, ever need.
     b) are a fantasy and shouldn't affect your purchase decision.
Read why and decide for yourself at http://cs.alfred.edu/~lansdoct/mstest.html
See http://www.heise.de/ct/english//99/13/186-1/ for more applicable tests.

Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com