[Israel.pm] new module for CPAN: Getopt::Long::String

Yuval Kogman nothingmuch at woobling.org
Mon Jan 30 14:43:23 PST 2006


On Mon, Jan 30, 2006 at 20:35:12 +0000, Mikhael Goikhman wrote:
> On 30 Jan 2006 19:59:02 +0200, Yuval Kogman wrote:
> > 
> > Shellwords is kind of like string2list, but probably more accurate
> > since string2list isn't necessarily shell oriented.
> 
> If the task is to parse the command line, like the shell does, then both
> shellwords and string2list are equally useless. Even simple input may
> produce unexpected result (at, least I didn't expect it before running):
> 
>   print "[$_]\n" foreach shellwords(q{ date });

This one is indeed very odd

>   print "[$_]\n" foreach shellwords(q{\""});

This one is expected - there are unbalanced parenthesis here.

> And I am not speaking already about total unawareness of special shell
> chars like "#", "(", "&", "|", ";". These two functions are, for example,
> usless if the task is to parse constructions common to many shells, like
> $((2 + 3)) or $(date; date) or ${HOME:s/h/ /} that may include whitespace.

For that there are full blown shell parsers =)

> BTW, reinventing wheel is one thing (useful to build XP stats), but fixing
> and replacing broken wheels is another. As well as inventing new cars.

I still think Shlomi's original suggestion was counter productive
;-)

-- 
 ()  Yuval Kogman <nothingmuch at woobling.org> 0xEBD27418  perl hacker &
 /\  kung foo master: /me sushi-spin-kicks : neeyah!!!!!!!!!!!!!!!!!!!!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://perl.org.il/pipermail/perl/attachments/20060131/5755c5af/attachment.pgp 


More information about the Perl mailing list