Getopt::Long and Options in single quotes? 
Author Message
 Getopt::Long and Options in single quotes?

Hi,

I use Getopt::Long and would like to allow not only double quotes
for parameters with spaces but also single quotes. Is there a way
to change this? I use Perl 5.005_03 on windows nt.

Regards,
Reiner Buehl



Tue, 05 Mar 2002 03:00:00 GMT  
 Getopt::Long and Options in single quotes?


Quote:
>I use Getopt::Long and would like to allow not only double quotes
>for parameters with spaces but also single quotes. Is there a way
>to change this? I use Perl 5.005_03 on windows nt.

This is a function of the shell.  The command-line shell that
comes with NT does not behave like Unix-based shells.  You may
want to look into the Cygwin environment which provides a bash
shell.

        --ewh
--
             Earl Hood              | University of California: Irvine

http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME



Tue, 05 Mar 2002 03:00:00 GMT  
 Getopt::Long and Options in single quotes?
[Posted and e-mailed.]

)
) I use Getopt::Long and would like to allow not only double quotes
) for parameters with spaces but also single quotes. Is there a way
) to change this? I use Perl 5.005_03 on windows nt.

Getopt::Long does abolutely nothing with quotes.  The quotes are
[mostly] handled by CMD.EXE on NT.  Even writing Perl code to try
to process the single quotes won't work for something like:

    perl script.pl 'just < one > arg only'

since CMD.EXE will treat it the same as:

    perl script.pl 'just only' <one >arg


even handle a simple C<perl script.pl 'two  spaces'> properly.

You can get real quote support including single quotes
by using, for example, bash instead of CMD.EXE.  See
http://sourceware.cygnus.com/cygwin/ for one option for
getting bash for NT.

With Perl via CMD.EXE, if you want to include C<"> in an argument,
use C<\"> and enclose the entire arguement in quotes.  If you want
to include C<\">, use C<\\\">, and so on.  Note that when C<\> is
not followed by C<">, you shouldn't double it like you otherwise
would:


    <\> <"> <\\> <"> <> <\> <\">

The use of C<""> seems to exercise some bugs in the C run-time
library [the behavior isn't metntioned in the documentation
and I can't make sense of it]:


    <abc d "> < w "xy z >
--
Tye McQueen    Nothing is obvious unless you are overlooking something
         http://www.metronet.com/~tye/ (scripts, links, nothing fancy)



Tue, 05 Mar 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Using Getopt::Long with multiple options in quotes

2. Getopt:Long arguments that are not (options or option values)

3. Problem checking if a command line option has been specified using Getopt::Long

4. ANNOUNCE: Getopt::Long 2.9 -- Universal command line options processing

5. ANNOUNCE: Getopt::Long 2.6 -- Universal command line options processing

6. Getopt::Long, using '?' as option

7. GetOpt::Long - Corequisite options?

8. ANNOUNCE: Getopt::Long 2.9 -- Universal command line options processing

9. ANNOUNCE: Getopt::Long 2.6 -- Universal command line options processing

10. Getopt::Long need a '-?' option

11. Tk-Options-0.10: Interface to Getopt::Long and Tk

12. replace single quote to double quote with an example

 

 
Powered by phpBB® Forum Software