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
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
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
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
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
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
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
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(
>
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" => \
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
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
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
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
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
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.
>
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(??
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
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
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
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
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
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
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
[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
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
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:
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
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
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
}
}
============
==
-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:
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
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-
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.
###
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
--- [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
- 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
>
> 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?
>
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(
, 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
> -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
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
- 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
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
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
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
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
* 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
47 matches
Mail list logo