Re: Getopt::Long

2012-05-16 Thread Manfred Lotz
Hi Rajesh, On Wed, 16 May 2012 16:11:13 +0530 Rajesh Saha 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; GetOptions('vers

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 w

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 G

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 wrote: > 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 messag

Re: Getopt::Long in perl

2010-07-29 Thread Jim Gibson
On 7/29/10 Thu Jul 29, 2010 1:17 AM, "Sooraj S" 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 parameter > "preser

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" To: "beginners" Sent: Tuesday, July 06, 2010 7:49 AM Subje

Re: Getopt::Long

2010-06-17 Thread Robert Wohlfarth
On Thu, Jun 17, 2010 at 6:50 AM, Shawn H Corey wrote: > 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 comp

Re: Getopt::Long

2010-06-17 Thread Chas. Owens
On Thu, Jun 17, 2010 at 07:50, Shawn H Corey wrote: > 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( >        

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" => \

Re: Getopt::Long

2010-06-17 Thread Chas. Owens
On Thu, Jun 17, 2010 at 02:36, 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";; > > What i expected this code to do is to die if a bad option was given, > say -s

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 /usr/local/share

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/Std

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

2008-08-04 Thread rafailowski
Mr. Shawn H. Corey wrote: On Mon, 2008-08-04 at 20:47 -0400, Mr. Shawn H. Corey wrote: On Tue, 2008-08-05 at 01:33 +0200, rafailowski wrote: Yes, without argument, the error is normal : $ perl test.pl Use of uninitialized value in hash element at /usr/local/share/perl/5.10.0/Log/StdLo

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

2008-08-04 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 u

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

2008-08-04 Thread Mr. Shawn H. Corey
On Mon, 2008-08-04 at 20:47 -0400, Mr. Shawn H. Corey wrote: > On Tue, 2008-08-05 at 01:33 +0200, rafailowski wrote: > > Yes, without argument, the error is normal : > > > > $ perl test.pl > > Use of uninitialized value in hash element at > > /usr/local/share/perl/5.10.0/Log/StdLog.pm line 57. >

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
On Tue, 2008-08-05 at 01:33 +0200, rafailowski wrote: > Yes, without argument, the error is normal : > > $ perl test.pl > Use of uninitialized value in hash element at > /usr/local/share/perl/5.10.0/Log/StdLog.pm line 57. > Use of uninitialized value in string at test.pl line 25. > > But with an

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 5

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 => $c

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 DoSomething

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; use

RE: Getopt::Long

2005-11-07 Thread Timothy Johnson
An excerpt from the documentation: " my $tag = ''; # option variable with default value GetOptions ('tag=s' => \$tag); In the option specification, the option name is followed by an equals sign "=" and the letter "s". The equals sign indicates that this option requires a

Re: getopt long behaviour

2005-09-09 Thread Manish Sapariya
Oh, my understanding is that when I specify "output=s" its a mandatory parameter and if not specified on command line, GetOptions should return error. Am i missing something? Thanks, Manish On 09/09/2005 05:56 PM, Chris Devers wrote: On Fri, 9 Sep 2005, Manish Sapariya wrote: Shouldn't

Re: getopt long behaviour

2005-09-09 Thread Jeff 'japhy' Pinyan
[PLEASE don't top-post; it makes it hard to follow the conversation] On Sep 9, Manish Sapariya said: On 09/09/2005 05:56 PM, Chris Devers wrote: On Fri, 9 Sep 2005, Manish Sapariya wrote: Shouldn't following snippet throw error message when it is called without any parameter? Because this

Re: getopt long behaviour

2005-09-09 Thread Manish Sapariya
Oh, my understanding is that when I specify "output=s" its a mandatory parameter and if not specified on command line, GetOptions should return error. Am i missing something? Thanks, Manish On 09/09/2005 05:56 PM, Chris Devers wrote: On Fri, 9 Sep 2005, Manish Sapariya wrote: Shouldn't fol

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

2005-04-22 Thread John Doe
Hi Wim > Hi Bob, > > You gave me the following answer earlier: > >sub foo { > > local @ARGV = @_; > GetOptions(...blah...); > > ... >} > > If I run it as a seperate script, commenting out the (local @ARGV = @_;) > line, then it works. But it does not work when called as

RE: GetOpt::Long

2005-04-21 Thread Olivier, Wim W
Hi Bob, You gave me the following answer earlier: sub foo { local @ARGV = @_; GetOptions(...blah...); ... } If I run it as a seperate script, commenting out the (local @ARGV = @_;) line, then it works. But it does not work when called as a subroutine from within the ma

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 [EMAI

RE: GetOpt::Long

2005-04-21 Thread Olivier, Wim W
} } ============ == -Original Message- From: Bob Showalter [mailto:[EMAIL PROTECTED] Sent: 20 April 2005 02:31 PM To: Olivier, Wim W; Perl Beginners (E-mail) Subject: RE: GetOpt::Long Olivier, Wim W wrote:

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

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-

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 , 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

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 > > P

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

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

2004-01-08 Thread Wiggins d Anconia
> > How do I take advantage of this? I turn it on but I do not know how to get > it to display a help message. If I pass in -h --help it just ends. I am > assuming I need some kind of pod file but I am unknowledgeable on how to > write a pod file. Also how do I tell it what pod file to open? >

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(

RE: getOpt::long?

2002-03-13 Thread Nikola Janceski
, March 13, 2002 11:28 AM To: 'michael' Cc: [EMAIL PROTECTED] Subject: RE: getOpt::long? answers your questions, though running perldoc -f getopt didn't return anything for me, so you might have to check some of the other sources. Hope this helps... Jason

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

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

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. > &g

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 in

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: > > -- > -it does make a difference- >-michael- > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] Okay, so what is the question? -- T

Re: Getopt::Long problem (Allegedly)

2002-01-30 Thread Briac Pilpré
On Wed, 30 Jan 2002 21:47:15 -, Angus Laycock wrote: > --=_NextPart_000_01D4_01C1A9D7.AEC826A0 > Content-Type: text/plain; > charset="iso-8859-1" > Content-Transfer-Encoding: quoted-printable > > Hi, > > I wrote this today on UNIX . When I tested the script, calling it with > all

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 it

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 > Unkno