473,231 Members | 1,632 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

A bug or perl sucks

Run a program like this:
perl c:\temp\test.pl -d "c:\program files\" -f "some file".

Getopt::Long

Getoptions is unable to correctly parse the options. You have to do some
thing like this:
perl c:\testl.pl -d "c:\program files\\" -f "some file"
Jul 19 '05 #1
3 3929
Steven Zhang wrote:
Run a program like this:
perl c:\temp\test.pl -d "c:\program files\" -f "some file".

Getopt::Long

Getoptions is unable to correctly parse the options.
This statement is close to useless.
What do you expect the result of Getoptions to be, what do you actually
observe, and in how far do those two differ?
You have to do
some thing like this:
perl c:\testl.pl -d "c:\program files\\" -f "some file"


Do something like this to achive _what_?

Please post a minimal, but complete program that demonstrates your problem.
I'm sure someone will be able to help you.

jue
Jul 19 '05 #2
The problem is: it is not consistent. The first "\" does not interpolate.
However, the last "\" gets interpolated, which escapses the close double
quote.

E.g, if it is -d "c:\\program files\\", the parsed value of option d will
be: c:\\program file\. If the options are -d "c:\program files\" -f ..., the
value of option d is: c:\program files" -f ... and no value of option f.

Here is the code:

use Getopt::Long ;

our $Usage = "Usage: test.pl -d=<full path> -f=<a filename\n";

our %options = ();

unless ( GetOptions ( \%options,

'd=s',

'f=s',

'help',

) ) {
print ( $Usage ) && exit( 1 );

}

print "option d: ".$options{"d"}."\n" if $options{"d"};

print "option f: ".$options{"f"}."\n" if $options{"f"};

unless ( $options{"f"}) {

print ( $Usage ) && exit( 1 );

}

"Jürgen Exner" <ju******@hotmail.com> wrote in message
news:E5H3d.6227$vd1.4809@trnddc03...
Steven Zhang wrote:
Run a program like this:
perl c:\temp\test.pl -d "c:\program files\" -f "some file".

Getopt::Long

Getoptions is unable to correctly parse the options.
This statement is close to useless.
What do you expect the result of Getoptions to be, what do you actually
observe, and in how far do those two differ?
You have to do
some thing like this:
perl c:\testl.pl -d "c:\program files\\" -f "some file"


Do something like this to achive _what_?

Please post a minimal, but complete program that demonstrates your

problem. I'm sure someone will be able to help you.

jue

Jul 19 '05 #3
This sounds more like a shell type issue, even in Windows the command
line has to make sense of what you are typing before Perl gets it.

For example I often find it a major pain that I have to do this:

find ./ -name \*.pm

Just the *.pm won't work.

# find ./ -name *.pm
find: Application.pm: unknown option

This is because of globbing, but I wonder if the / problem you are
having is something along the same lines.

Thanks,

Eric
Steven Zhang wrote:
The problem is: it is not consistent. The first "\" does not interpolate.
However, the last "\" gets interpolated, which escapses the close double
quote.

E.g, if it is -d "c:\\program files\\", the parsed value of option d will
be: c:\\program file\. If the options are -d "c:\program files\" -f ..., the
value of option d is: c:\program files" -f ... and no value of option f.

Here is the code:

use Getopt::Long ;

our $Usage = "Usage: test.pl -d=<full path> -f=<a filename\n";

our %options = ();

unless ( GetOptions ( \%options,

'd=s',

'f=s',

'help',

) ) {
print ( $Usage ) && exit( 1 );

}

print "option d: ".$options{"d"}."\n" if $options{"d"};

print "option f: ".$options{"f"}."\n" if $options{"f"};

unless ( $options{"f"}) {

print ( $Usage ) && exit( 1 );

}

"Jürgen Exner" <ju******@hotmail.com> wrote in message
news:E5H3d.6227$vd1.4809@trnddc03...
Steven Zhang wrote:
Run a program like this:
perl c:\temp\test.pl -d "c:\program files\" -f "some file".

Getopt::Long

Getoptions is unable to correctly parse the options.


This statement is close to useless.
What do you expect the result of Getoptions to be, what do you actually
observe, and in how far do those two differ?

You have to do
some thing like this:
perl c:\testl.pl -d "c:\program files\\" -f "some file"


Do something like this to achive _what_?

Please post a minimal, but complete program that demonstrates your


problem.
I'm sure someone will be able to help you.

jue



Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: I Report, You Decide | last post by:
A hosting service lungcapage has banned yabb, because it takes too much CPU/memory, but phpBB is fine. Is that perl/php or the script itself? why perl sucks more resource of a server than php? i...
6
by: DesignGuy | last post by:
I've read comparison of Perl vs. PHP regarding features and coding, however I would like to know how each affects server load. I am looking at two scripts - one in Perl and the other in PHP - for...
58
by: @ | last post by:
A benchmark in 2002 showed PHP is much slower in shell or when Apache has Mod_Perl. With the new PHP kissing Java's ass, Perl is once again the #1 CGI choice. Java is for a big team in short...
9
by: Roy Smith | last post by:
I'm working on a prototype of a new application in Python. At some point, if this ever turns into a product, the powers that be will almost certainly demand that it be done in Perl. My job will...
23
by: John M. Gabriele | last post by:
I recently posted this sort of question to the c.l.p.m but didn't get much of a response. I know a little Perl and a little Python, but master neither at the moment. I see that Python is a...
49
by: Relaxin | last post by:
It is just me or has MS created some of the worst ways to access and display data? You can use a DataSet, but if you want to sort or filter the data to must use a DataView which is created from...
6
by: Richard Trahan | last post by:
I want a js function to call a Perl script residing on a server. The Perl script will return a string, to be used by the js. Pseudo code: <script> stringvar = perlfunc_on_server(stringarg)...
385
by: Xah Lee | last post by:
Jargons of Info Tech industry (A Love of Jargons) Xah Lee, 2002 Feb People in the computing field like to spur the use of spurious jargons. The less educated they are, the more they like...
16
by: zwetan | last post by:
Hi, often I see people telling that "javascript sucks" - is it because of the DOM with JS ? - is it because of the language in itself ? - is it because browsers/hosts differences ? - is it...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.