473,383 Members | 1,925 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,383 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 3932
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.