Getopt::Long

2012-05-16 Thread Rajesh Saha
Hi, In my program, I am using the module Getopt::Long My intension is that if the user chooses --help, the program should show the help message without bothering whether other options has been used or not. My program (say, test.pl) : use Getopt::Long my $abc; my $help; Getoptions ( abc=s

Re: Getopt::Long

2012-05-16 Thread Rajesh Saha
Hi, Sorry for one typo. Read GetOptions in place of Getoptions . Regards, Rajesh On Wed, May 16, 2012 at 2:39 PM, Rajesh Saha rajeshsaha...@gmail.comwrote: Hi, In my program, I am using the module Getopt::Long My intension is that if the user chooses --help, the program should show

RE: Getopt::Long

2012-05-16 Thread Michael Brader
Hi, Your problem is that Getopt::Long is consuming your -help as the argument to -abc before it can be recognised. You might be able to do something with the other Getopt::* modules, but the following piece of code will do what you want if you really need it: use List::MoreUtils qw(any); use

Re: Getopt::Long

2012-05-16 Thread Brandon McCaig
On Wed, May 16, 2012 at 10:56:59AM +, Michael Brader wrote: Hi, Hello: Your problem is that Getopt::Long is consuming your -help as the argument to -abc before it can be recognised. You might be able to do something with the other Getopt::* modules, but the following piece of code

Re: Getopt::Long

2012-05-16 Thread Manfred Lotz
Hi Rajesh, On Wed, 16 May 2012 16:11:13 +0530 Rajesh Saha rajeshsaha...@gmail.com wrote: Hi, Sorry for one typo. Read GetOptions in place of Getoptions . Regards, Rajesh Here is how I do it: #! /usr/bin/perl use strict; use warnings; use Getopt::Long; my $dry_run = 0

Getopt::Long in perl

2010-07-29 Thread Sooraj S
Hi, I am using Getopt::Long to accept the command line arguments. Logic - I have two mandatory options. 1.mod1_num 2.mod2_num Both of them can accept either a 3digit number or another parameter preserve which inturn accepts a 3digit number. eg: my_script -mod1_num 123 -mod2_num 234

Re: Getopt::Long in perl

2010-07-29 Thread Jim Gibson
On 7/29/10 Thu Jul 29, 2010 1:17 AM, Sooraj S soorajspadmanab...@gmail.com scribbled: Hi, I am using Getopt::Long to accept the command line arguments. Logic - I have two mandatory options. 1.mod1_num 2.mod2_num Both of them can accept either a 3digit number or another

getopt::long

2010-07-06 Thread Unknown User
um, I am pretty sure getopt::long keeps all input data in a hash, does anybody know whether i can use that hash itself in my code, and if so, how? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: getopt::long

2010-07-06 Thread Octavian Rasnita
Hi, use strict; use warnings; use Getopt::Long; my %hash; GetOptions(\%hash, first=s, second|s=s, third=i); print $hash{first}, $hash{second}, $hash{third}, \n; -- Octavian - Original Message - From: Unknown User knowsuperunkn...@gmail.com To: beginners beginners@perl.org Sent

Getopt::Long

2010-06-17 Thread Unknown User
I have the following code: GetOptions( n|name=s = \$name, a|age=i = \$age, s|sex=s = \$sex, ) || die Bad options\n;; What i expected this code to do is to die if a bad option was given, say -s without an arguement, as in ./myprog -n name -s -a 20 However, it does not do

Re: Getopt::Long

2010-06-17 Thread Chas. Owens
, say -s without an arguement, as in ./myprog -n name -s -a 20 However, it does not do that. What would be the correct method to die if one of the options is not complete? GetOptions should print a warning and return a false value in that case. What version of Perl and Getopt::Long are you using

Re: Getopt::Long

2010-06-17 Thread Shawn H Corey
On 10-06-17 02:36 AM, Unknown User wrote: I have the following code: GetOptions( n|name=s = \$name, a|age=i = \$age, s|sex=s = \$sex, ) || die Bad options\n;; GetOptions( name=s =\$name, age=i = \$age, sex=s = \$sex, ) || die Bad

Re: Getopt::Long

2010-06-17 Thread Chas. Owens
use strict; use warnings; use Getopt::Long; #to test, run with no args unless (@ARGV) { for my $args ( [ qw/-n name -a 5 -s M/ ], [ qw/-n -a 5 -s M/ ], [ qw/-n name -a a -s M/ ], [ qw/-n name -a -s M

Re: Getopt::Long

2010-06-17 Thread Robert Wohlfarth
On Thu, Jun 17, 2010 at 6:50 AM, Shawn H Corey shawnhco...@gmail.comwrote: On 10-06-17 02:36 AM, Unknown User wrote: I have the following code: GetOptions( n|name=s = \$name, a|age=i = \$age, s|sex=s = \$sex, ) || die Bad options\n;; But they are complete.

Re: Getopt::Long and Log::StdLog problem

2008-08-05 Thread rafailowski
Rob Dixon wrote: rafailowski wrote: I have a problem with Getopt::Long and Log::StdLog. An example script, i always have the following error : Use of uninitialized value in hash element at /usr/local/share/perl/5.10.0/Log/StdLog.pm line 57 level = $cmd_args_ref-{log_level} is always

Re: Getopt::Long and Log::StdLog problem

2008-08-05 Thread rafailowski
$cmd_args_ref-{log_level}; return the good value. I don't understand why in : use Log::StdLog {...}, the value of $cmd_args_ref-{log_level} stay always undef??? Sorry, I was thinking about the problem correctly. Try: #!/usr/bin/perl use Getopt::Long; use Log::StdLog; my %cmd_args

Re: Getopt::Long and Log::StdLog problem

2008-08-05 Thread Mr. Shawn H. Corey
On Tue, 2008-08-05 at 08:57 +0200, rafailowski wrote: Thx but adding __END__ return me this error, anyway the problem is solve with a BEGIN block (cf.Rob Dixon). $ perl test.pl --log-level=debug Name main::STDLOG used only once: possible typo at /usr/local/share/perl/5.10.0/Log/StdLog.pm

Re: Getopt::Long and Log::StdLog problem

2008-08-05 Thread rafailowski
Mr. Shawn H. Corey wrote: On Tue, 2008-08-05 at 08:57 +0200, rafailowski wrote: Thx but adding __END__ return me this error, anyway the problem is solve with a BEGIN block (cf.Rob Dixon). $ perl test.pl --log-level=debug Name main::STDLOG used only once: possible typo at

Getopt::Long and Log::StdLog problem

2008-08-04 Thread rafailowski
Hi all, I have a problem with Getopt::Long and Log::StdLog. An example script, i always have the following error : Use of uninitialized value in hash element at /usr/local/share/perl/5.10.0/Log/StdLog.pm line 57 level = $cmd_args_ref-{log_level} is always undef(???) but print $cmd_args_ref

Re: Getopt::Long and Log::StdLog problem

2008-08-04 Thread Mr. Shawn H. Corey
On Tue, 2008-08-05 at 01:05 +0200, rafailowski wrote: Hi all, I have a problem with Getopt::Long and Log::StdLog. An example script, i always have the following error : Use of uninitialized value in hash element at /usr/local/share/perl/5.10.0/Log/StdLog.pm line 57 level

Re: Getopt::Long and Log::StdLog problem

2008-08-04 Thread rafailowski
Mr. Shawn H. Corey wrote: On Tue, 2008-08-05 at 01:05 +0200, rafailowski wrote: Hi all, I have a problem with Getopt::Long and Log::StdLog. An example script, i always have the following error : Use of uninitialized value in hash element at /usr/local/share/perl/5.10.0/Log/StdLog.pm line

Re: Getopt::Long and Log::StdLog problem

2008-08-04 Thread Mr. Shawn H. Corey
Log::StdLog {...}, the value of $cmd_args_ref-{log_level} stay always undef??? Sorry, I was thinking about the problem correctly. Try: #!/usr/bin/perl use Getopt::Long; use Log::StdLog; my %cmd_args = (); my $cmd_args_ref = \%cmd_args; GetOptions( log-level=s = \$cmd_args

Re: Getopt::Long and Log::StdLog problem

2008-08-04 Thread Rob Dixon
rafailowski wrote: I have a problem with Getopt::Long and Log::StdLog. An example script, i always have the following error : Use of uninitialized value in hash element at /usr/local/share/perl/5.10.0/Log/StdLog.pm line 57 level = $cmd_args_ref-{log_level} is always undef

Re: Getopt::Long and Log::StdLog problem

2008-08-04 Thread Mr. Shawn H. Corey
$cmd_args_ref-{log_level}; return the good value. I don't understand why in : use Log::StdLog {...}, the value of $cmd_args_ref-{log_level} stay always undef??? Sorry, I was thinking about the problem correctly. Try: #!/usr/bin/perl use Getopt::Long; use Log::StdLog; my %cmd_args

Paths, Spaces, Getopt::Long

2007-06-03 Thread Mike Lesser
Hi all. I have a problem that _must_ have a very simple solution (that I can't find). I use the module Getopt::Long to read arguments, one of which is a file path that may have spaces. The path string that is returned from Getopt has spaces without escape chars. The string seems

Re: Paths, Spaces, Getopt::Long

2007-06-03 Thread Tom Phoenix
On 6/3/07, Mike Lesser [EMAIL PROTECTED] wrote: I use the module Getopt::Long to read arguments, one of which is a file path that may have spaces. The path string that is returned from Getopt has spaces without escape chars. The string seems to be fine for Perl use, but not so great for other

Re: Paths, Spaces, Getopt::Long

2007-06-03 Thread Chas Owens
On 6/3/07, Mike Lesser [EMAIL PROTECTED] wrote: snip I have to assume that paths can be converted easily for use in shells and such, without resorting to RegEx. Any ideas? snip Aside from the multi argument version of system that Tom has already mentioned, the bigger question is Why are you

Fwd: Paths, Spaces, Getopt::Long

2007-06-03 Thread Mike Lesser
Well I'm not sure. I may be explaining this badly. I'll go thru all the details in case it helps. The path I pass when I'm executing the script is escaped, which I assume is correct. Once that path is read by Getopt, I print it and, voila, no escapes, just nice-to-read spaces. This

Fwd: Paths, Spaces, Getopt::Long

2007-06-03 Thread Mike Lesser
Begin forwarded message: From: Mike Lesser [EMAIL PROTECTED] Date: June 3, 2007 3:48:56 PM EDT To: Chas Owens [EMAIL PROTECTED] Subject: Re: Paths, Spaces, Getopt::Long On Jun 3, 2007, at 1:59 PM, Chas Owens wrote: On 6/3/07, Mike Lesser [EMAIL PROTECTED] wrote: snip I have to assume

Re: Paths, Spaces, Getopt::Long

2007-06-03 Thread Mike Lesser
On Jun 3, 2007, at 1:59 PM, Chas Owens wrote: On 6/3/07, Mike Lesser [EMAIL PROTECTED] wrote: snip I have to assume that paths can be converted easily for use in shells and such, without resorting to RegEx. Any ideas? snip Aside from the multi argument version of system that Tom has already

Re: Paths, Spaces, Getopt::Long

2007-06-03 Thread Chas Owens
On 6/3/07, Mike Lesser [EMAIL PROTECTED] wrote: snip Then I attempted to use Tidy, sans HTML::Tidy, through Shell. The HTML::Tidy lib won't work on my system. So, I have been futzing with tidy and I'v e discovered that tidy and simple commands like cd fail, most likely because of the spaces in

Re: Paths, Spaces, Getopt::Long

2007-06-03 Thread Chas Owens
On 6/3/07, Chas Owens [EMAIL PROTECTED] wrote: snip my $tidy = /usr/bin/tidy; my @tidy_args = qw(--foo --bar -- example); my $path = get_path(); my $file = $path . get_file(); system($tidy, @tidy_args, $file); Opps, forgot the error checking. system($tidy, @tidy_args, $file) or die

Re: Paths, Spaces, Getopt::Long

2007-06-03 Thread Chas Owens
On 6/3/07, Chas Owens [EMAIL PROTECTED] wrote: On 6/3/07, Chas Owens [EMAIL PROTECTED] wrote: snip my $tidy = /usr/bin/tidy; my @tidy_args = qw(--foo --bar -- example); my $path = get_path(); my $file = $path . get_file(); system($tidy, @tidy_args, $file); Opps, forgot the error checking.

Re: Paths, Spaces, Getopt::Long

2007-06-03 Thread Mike Lesser
Okay, I eliminated the tidy with some more robust regex. D'oh! Case closed! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Paths, Spaces, Getopt::Long

2007-06-03 Thread John W. Krahn
Chas Owens wrote: On 6/3/07, Chas Owens [EMAIL PROTECTED] wrote: On 6/3/07, Chas Owens [EMAIL PROTECTED] wrote: snip my $tidy = /usr/bin/tidy; my @tidy_args = qw(--foo --bar -- example); my $path = get_path(); my $file = $path . get_file(); system($tidy, @tidy_args, $file); Opps,

Re: Getopt::Long

2005-11-08 Thread Shawn Corey
Chris Knipe wrote: So, this is more of a block question I think, but how I can get the above example to show the help screen FIRST, and THEN complain about the missing value for -s Why? Here's an example of how to do it: #!/usr/bin/perl use strict; use warnings; use File::Basename;

Re: Getopt::Long

2005-11-08 Thread Bob Showalter
Chris Knipe wrote: Hi all, Just a quick question and a couple of lines of really simple code use Getopt::Long; ... GetOptions ('h' = \$h, 'b=s' = \$s ); Sub ShowHelp() { That should be sub ShowHelp { Perl isn't VB :) print this is help } Sub

Getopt::Long

2005-11-07 Thread Chris Knipe
Hi all, Just a quick question and a couple of lines of really simple code use Getopt::Long; ... GetOptions ('h' = \$h, 'b=s' = \$s ); Sub ShowHelp() { print this is help } Sub DoSomethingWithString() { ... } If ($s) { DoSomethingWithString(); } else { ShowHelp

RE: Getopt::Long

2005-11-07 Thread Timothy Johnson
. The letter s indicates that this value is an arbitrary string. Other possible value types are i for integer values... -Original Message- From: Chris Knipe [mailto:[EMAIL PROTECTED] Sent: Monday, November 07, 2005 7:38 PM To: beginners@perl.org Subject: Getopt::Long Hi all

getopt long behaviour

2005-09-09 Thread Manish Sapariya
Shouldn't following snippet throw error message when it is called without any parameter? I can't see any error messsage, why? # /tmp/test.pl Executed successfully # -- #!/usr/bin/perl use Getopt::Long; GetOptions(verbose = \$verbose, debug= \$debug

Re: getopt long behaviour

2005-09-09 Thread Chris Devers
On Fri, 9 Sep 2005, Manish Sapariya wrote: Shouldn't following snippet throw error message when it is called without any parameter? I can't see any error messsage, why? Because this didn't have an error. If you want it to quit, force it to quit. #!/usr/bin/perl use Getopt

Re: getopt long behaviour

2005-09-09 Thread Manish Sapariya
following snippet throw error message when it is called without any parameter? I can't see any error messsage, why? Because this didn't have an error. If you want it to quit, force it to quit. #!/usr/bin/perl use Getopt::Long; GetOptions(verbose = \$verbose, debug

Re: getopt long behaviour

2005-09-09 Thread Manish Sapariya
following snippet throw error message when it is called without any parameter? I can't see any error messsage, why? Because this didn't have an error. If you want it to quit, force it to quit. #!/usr/bin/perl use Getopt::Long; GetOptions(verbose = \$verbose

Re: GetOpt::Long

2005-04-22 Thread John Doe
- but maybe in the sense you mentioned that it works for you too: === begin script (test3.pl) === use strict; use warnings; use Getopt::Long; sub notify_email { local @ARGV = @_; my (@recipients, @subject, @body); my %conf=(smtp='whatever', smtpsender='something'); $ENV{NTsendmail} = $conf{'smtp

RE: GetOpt::Long

2005-04-21 Thread Olivier, Wim W
Hi Bob, (Offer Kaye, thanks for the reply as well!) I used the method below (local @ARGV = @_;) to get the values of @_ into @ARGV for the use of Getopt::Long. It appears to be working fine like that. I now have another problem with, it appears, syntax. The IF statement is part of a block

RE: GetOpt::Long

2005-04-21 Thread Bob Showalter
Olivier, Wim W wrote: Hi Bob, Hi. Don't top-post please. If I comment out this if statement, I don't get the error anymore. An clues as to the correct syntax??? I run the subroutine as follows: if ($conf{'pnl_check_for_analytics_email'} =~ 'ON') { notify_email -r [EMAIL

RE: GetOpt::Long

2005-04-21 Thread Olivier, Wim W
= @_; # Get the sub's params into the master param array for GetOpt::Long $ENV{NTsendmail} = $conf{'smtp'}; $sender = $conf{'smtpsender'}; GetOptions (r=s = [EMAIL PROTECTED], # -r [EMAIL PROTECTED] -r [EMAIL PROTECTED] -r [EMAIL PROTECTED] s=s = [EMAIL

GetOpt::Long

2005-04-20 Thread Olivier, Wim W
Hi all, Is it possible to use GetOpt::Long (or something similar) in a subroutine using @_ instead of in the standard way (using @ARGV)? I want to have the following scenario, but use GetOpt in a subrouting within the main script and pass options (and values) to the subroutine. The values

RE: GetOpt::Long

2005-04-20 Thread Tim Johnson
How about something like this? It doesn't make it like GetOpt::Long, but it does handle what you want. Or you could just require that people pass an array to your subroutine and save yourself a little work. If there is only one recipient, then it's a one-element array

RE: GetOpt::Long

2005-04-20 Thread Bob Showalter
Olivier, Wim W wrote: Hi all, Is it possible to use GetOpt::Long (or something similar) in a subroutine using @_ instead of in the standard way (using @ARGV)? This should work: sub foo { local @ARGV = @_; GetOptions(...blah...); ... } -- To unsubscribe, e-mail

Re: GetOpt::Long

2005-04-20 Thread Offer Kaye
On 4/20/05, Olivier, Wim W wrote: Hi all, Is it possible to use GetOpt::Long (or something similar) in a subroutine Getargs::Long - http://search.cpan.org/dist/Getargs-Long/ HTH, -- Offer Kaye -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED

need help for Getopt::Long;

2005-03-25 Thread Shiping Wang
Hi, I have problem to match array defined in Getopt::Long and transfer to new file: If I do: try.pl --InputData sample.txt --Trait=_BMI --covars=age, _DBP, _SBP --Race=Others with this file: GFAMID GDADID GMOMID ID SEX HYT3 _SBP _DBP _BMI RACE AGE _HTMED antiht How can I get

Re: need help for Getopt::Long; --resolved

2005-03-25 Thread Shiping Wang
At 10:46 AM 3/25/2005 -0600, Shiping Wang wrote: Hi, I have problem to match array defined in Getopt::Long and transfer to new file: If I do: try.pl --InputData sample.txt --Trait=_BMI --covars=age, _DBP, _SBP --Race=Others with this file: GFAMID GDADID GMOMID ID SEX HYT3 _SBP _DBP _BMI

Getopt::Long , handles the number zero differently..

2004-12-21 Thread Mike Donnelly
Using the example code below, I find that I can use getopt handily to pass all sorts of variables to my script, as long as a value passed is not a 0 (zero) How to I use getopt::long and be able to pass the number zero as a value? Code, and behavior follows

Re: Getopt::Long , handles the number zero differently..

2004-12-21 Thread mgoland
- Original Message - From: Mike Donnelly [EMAIL PROTECTED] Date: Tuesday, December 21, 2004 10:58 am Subject: Getopt::Long , handles the number zero differently.. Hello Using the example code below, I find that I can Please paste working code use getopt handily to pass all

Re: Getopt::Long , handles the number zero differently..

2004-12-21 Thread Mike Donnelly
--- [EMAIL PROTECTED] wrote: - Original Message - From: Mike Donnelly [EMAIL PROTECTED] Date: Tuesday, December 21, 2004 10:58 am Subject: Getopt::Long , handles the number zero differently.. Hello Using the example code below, I find that I can Please paste

Getopt::Long , handles the number zero differently..

2004-12-21 Thread Mike Donnelly
Using the example code below, I find that I can use getopt handily to pass all sorts of variables to my script, as long as a value passed is not a 0 (zero) How to I use getopt::long and be able to pass the number zero as a value? Code, and behavior follows

Re: Getopt::Long , handles the number zero differently..

2004-12-21 Thread John W. Krahn
Mike Donnelly wrote: Using the example code below, I find that I can use getopt handily to pass all sorts of variables to my script, as long as a value passed is not a 0 (zero) How to I use getopt::long and be able to pass the number zero as a value? Code, and behavior follows

Getopt::Std vs. Getopt::Long

2004-07-14 Thread perl.org
I have been using Getopt::Std for some time and I'm pretty happy with it. I've been reading about Getopt::Long and it seems to support everything in Getopt::Std and has some nice conveniences. Does anyone have experience converting scripts (or just development process) from Std to Long? Does

Re: Getopt::Std vs. Getopt::Long

2004-07-14 Thread Wiggins d Anconia
I have been using Getopt::Std for some time and I'm pretty happy with it. I've been reading about Getopt::Long and it seems to support everything in Getopt::Std and has some nice conveniences. Does anyone have experience converting scripts (or just development process) from Std to Long

Getopt::Long::Configure('auto_help')

2004-01-08 Thread Paul Kraus
Getopt::Long Configuring Getopt::Long Getopt::Long can be configured by calling subroutine Getopt::Long::Configure(). This subroutine takes a list of quoted strings, each specifying a configuration option to be enabled, e.g. ignore_case, or disabled, e.g. no_ignore_case. Case does

Re: Getopt::Long::Configure('auto_help')

2004-01-08 Thread Wiggins d Anconia
perldoc Getopt::Long Configuring Getopt::Long Getopt::Long can be configured by calling subroutine Getopt::Long::Configure(). This subroutine takes a list of quoted strings, each specifying a configuration option to be enabled, e.g. ignore_case, or disabled, e.g

Using GetOpt::Long

2002-09-19 Thread David Samuelsson (PAC)
this: use Getopt::Long; if (!GetOptions(reg_backup = \$reg_backup, html = \$html) ){err_exit($usage\n,0);} if (defined ($reg_backup) ){reg_backup()} if (defined($html)){create_html()} etc.. when i execute the script it does as its told, but if i want to combine the 2 subs

RE: Using GetOpt::Long

2002-09-19 Thread Jeff AA
-Original Message- From: David Samuelsson (PAC) [mailto:[EMAIL PROTECTED]] Sent: 19 September 2002 08:09 To: '[EMAIL PROTECTED]' Subject: Using GetOpt::Long I found this module was a part off the package, and tried it out, it works as i want. I have some troubles though, i

RE: Using GetOpt::Long

2002-09-19 Thread David Samuelsson (PAC)
] Subject: RE: Using GetOpt::Long -Original Message- From: David Samuelsson (PAC) [mailto:[EMAIL PROTECTED]] Sent: 19 September 2002 08:09 To: '[EMAIL PROTECTED]' Subject: Using GetOpt::Long I found this module was a part off the package, and tried it out, it works as i want. I

RE: Using GetOpt::Long

2002-09-19 Thread Jeff AA
-Original Message- From: David Samuelsson (PAC) [mailto:[EMAIL PROTECTED]] Sent: 19 September 2002 09:03 To: 'Jeff AA'; [EMAIL PROTECTED] Subject: RE: Using GetOpt::Long I want it so it will execute the subs in the order according to the lines when i start the scrippt

Re: Using GetOpt::Long

2002-09-19 Thread Michael Fowler
don't want to make other people use the '--' switches to use the script? Why not? Getopt::Long will probably accommodate you in this, but I would suggest reserving the single '-' for one-letter options, and the double '-' for long options. That way, the one-letter options can be bundled, e.g. -rh

RE: Using GetOpt::Long

2002-09-19 Thread David Samuelsson (PAC)
(PAC) Cc: [EMAIL PROTECTED] Subject: Re: Using GetOpt::Long On Thu, Sep 19, 2002 at 10:02:32AM +0200, David Samuelsson (PAC) wrote: I want it so it will execute the subs in the order according to the lines when i start the scrippt, and i will try to keep to default -value cause the scipt

a bit over the top wraper for Getopt::Long

2002-08-30 Thread drieux
://www.wetware.com/drieux/pbl/perlTrick/CommandLine/do_get_opt_long.txt This was derived from a form we had been using as a sorta stock way to spin up bunches of command line options with Getopt::Long - http://www.wetware.com/drieux/pbl/perlTrick/CommandLine/simple_get_long.txt I just always promised myself

Re: Getopt::Long option prefix

2002-08-26 Thread Karl Kaufman
Hi David, From what I've seen, Getopt::Long default behavior is to accept either '--opt|-opt'. (Tested on Solaris 2.6 w/ Perl 5.005_03) test.pl #!/usr/local/bin/perl use strict; use diagnostics; use Getopt::Long; my %pagerdest = (); Getopt::Long::Configure('default'); GetOptions

Parameter parsing with Getopt::Long in functions

2002-06-15 Thread Robert Kasunic
Hello, I'm trying to use Getopt::Long for parsing parameters passed to a function. I tried to test if that works by using the following script. --- #!/usr/bin/perl -w use strict; use Getopt::Long; sub test_params() { @ARGV=@_; print

Re: Parameter parsing with Getopt::Long in functions

2002-06-15 Thread Paul Johnson
On Sat, Jun 15, 2002 at 06:10:23PM +0200, Robert Kasunic wrote: Hello, I'm trying to use Getopt::Long for parsing parameters passed to a function. I tried to test if that works by using the following script. --- #!/usr/bin/perl -w use

Re: Parameter parsing with Getopt::Long in functions

2002-06-15 Thread drieux
On Saturday, June 15, 2002, at 09:10 , Robert Kasunic wrote: I'm trying to use Getopt::Long for parsing parameters passed to a function. I tried to test if that works by using the following script. --- #!/usr/bin/perl -w use strict

Re: Parameter parsing with Getopt::Long in functions

2002-06-15 Thread drieux
(--opta argument_a -b -c); test_params(-b); test_params(-c -b); H! My complements The problem is not really with the Getopt::Long, but with the need to be more sensitive to a) perldoc perlsub - cf the prototyping problem here - note the warning

Re: getOpt::long?

2002-03-13 Thread Jenda Krynicky
From: Michael [EMAIL PROTECTED] I am a true perl newbie. If you continue like this you will stay one. I am supposed to: Write a program that finds lines in an input file and copies them to an output file . The program takes the following arguments: an input file

Re: getOpt::long?

2002-03-13 Thread michael
- Original Message - From: Jenda Krynicky [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 13, 2002 7:10 AM Subject: Re: getOpt::long? From: Michael [EMAIL PROTECTED] I am a true perl newbie. If you continue like this you will stay one. :-) Thanks for all

Re: getOpt::long?

2002-03-13 Thread Jenda Krynicky
From: michael [EMAIL PROTECTED] :-) Thanks for all the feedback. I had intended to send the assignment as an attachment and ask about: 1) Configuring my win2k box so that I could use the command line to run a perl program without having to type 'perl' before the name of the

RE: getOpt::long?

2002-03-13 Thread Jason Larson
-Original Message- From: michael [mailto:[EMAIL PROTECTED]] Subject: Re: getOpt::long? I am a true perl newbie. If you continue like this you will stay one. :-) Thanks for all the feedback. I had intended to send the assignment as an attachment and ask about: 1

RE: getOpt::long?

2002-03-13 Thread Nikola Janceski
try $ perldoc Getopt No documentation found for Getopt. However, try perldoc Getopt::Long perldoc Getopt::Std perldoc Getopt::Long.html perldoc Getopt::Std.html -Original Message- From: Jason Larson [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 13

getOpt::long?

2002-03-12 Thread Michael
on the usage of Getopt functions, type the following commands: $ perldoc Getopt::Std $ perldoc Getopt::Long Take into account the following conditions: The input file should exist. If the output file does NOT exist, create one. If exists, append the output to the file. What if the end offset

Re: getOpt::long?

2002-03-12 Thread Chas Owens
On Tue, 2002-03-12 at 21:50, Michael wrote: I am a true perl newbie. I am supposed to: snip reason=homework/test / -- -it does make a difference- -michael- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Okay, so what is

Getopt::Long problem (Allegedly)

2002-01-30 Thread Angus Laycock
software which uses -s as an option and need to handle the options the same in the PERL replacement. Is there a bug with s:s? use Getopt::Long; my $DATABASE = ; my $PASSWORD = ; my $USER = ; my $SERVER = ; my $ERR = ; my $SPROC = ; my $QUERY = ; my $TT = ; GetOptions ( 'f:s' = \$TT, 's:s

Re: Getopt::Long problem (Allegedly)

2002-01-30 Thread Briac Pilpré
replacement. Is there a bug with s:s? By default, Getopt::Long is case insensitive. Try adding the bundling and ignore_case options. cf perldoc Getopt::Long (Configuring Getopt::Long) #!/usr/bin/perl -w use strict; use Getopt::Long qw(GetOptions); Getopt::Long::Configure (bundling, ignore_case); my

GetOpt::Long - Usage question

2001-08-15 Thread pn
Hi, I am unable to get the following inherited code, using Getopt::Long, to work. It is my understanding that Perl will automatically create a $opt_help variable ( for a -help command line option). However, when I try to print it's value, it returns a null value. In addition, the help mesage

Re: GetOpt::Long - Usage question

2001-08-15 Thread Michael Fowler
On Wed, Aug 15, 2001 at 02:49:34PM -0700, pn wrote: #/usr/bin/perl -w use strict; # Forward declarations my $opt_help; This is your problem right here. Getopt::Long sets the package global $main::opt_help, but now that you've declared the variable lexical, anytime you access

can't able to understand this behaviour of Getopt::Long

2001-08-03 Thread Rajanikanth Dandamudi
Hello, I am not able to understand the following behaviour of perl Getopt::Long. Here is the snippet of code that I am not able to understand: Start of code - #!/usr/local/bin/perl use Getopt::Long; my $filename; print Before : ARGV = @ARGV\n

is there a module ala getopt::long that will ... as well as command-line completion

2001-07-30 Thread Matt Lyon
here's one for the group... is there a module ala getopt::long that will do the arg-getting as well as command-line completion with a predefined list/hash/etc... of keywords? -mL -- Life would be so much easier if its source code was well-commented. -- To unsubscribe, e-mail: [EMAIL PROTECTED

Getopt::Long

2001-07-21 Thread Bicknell, Frank
I'm not sure if this is the right forum, but here goes (I'm a beginner at posting questions to the list?) Using Getopt::Long, it's possible to watch for negated options: -nostuff ... and it's possible to alias options stuff|such allows -stuff to be the same as -such. So this little sample

Re: Getopt::Long

2001-07-21 Thread iain truskett
* Bicknell, Frank ([EMAIL PROTECTED]) [21 Jul 2001 08:12]: [...] Using Getopt::Long, it's possible to watch for negated options: -nostuff ... and it's possible to alias options stuff|such allows -stuff to be the same as -such. [...] $ stuff -nosuch Using Perl Version 5.00404 Unknown