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

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

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 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 "--h

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

Re: Help with Getopt::Std

2011-10-22 Thread Peter Scott
On Sat, 22 Oct 2011 11:58:38 +1300, newbie01 perl wrote: > Am just trying to port 1:1. Quite painful trying to figure out how to > get awk-like behavior in Perl especially when trying to do some > calculation on some specific fields. Awk is Perl's closest ancestor on the evolutionary tree, from on

Re: Help with Getopt::Std

2011-10-21 Thread newbie01 perl
Hi Brandon, Thanks for your response. Getopt::Std seems to be the simplest one, so am tryiing that one out first :-) Am just trying to port 1:1. Quite painful trying to figure out how to get awk-like behavior in Perl especially when trying to do some calculation on some specific fields. I&#x

Re: Help with Getopt::Std

2011-10-20 Thread Brandon McCaig
On Thu, Oct 20, 2011 at 11:45 PM, newbie01 perl wrote: > Playing around with Getopt::Std as am trying to convert a UNIX > Korn Shell Script to a Perl script. > > Is it possible to check for what are the values for opterr, > optarg, optind? How? :(- There are many Getopt:: packag

Help with Getopt::Std

2011-10-20 Thread newbie01 perl
Hi all, Playing around with Getopt::Std as am trying to convert a UNIX Korn Shell Script to a Perl script. Is it possible to check for what are the values for opterr, optarg, optind? How? :(- I've been Googling for quite sometime now and can't find an example of Perl scripts that

Re: Not walking together with Getopt Module

2011-08-23 Thread Brandon McCaig
hat your problem was just from reading your message. :) It looks like your problem is passing the value of $age instead of a reference to $age. In order for the Getopt::Long module to modify your $age variable it needs a reference to it: use strict; use warnings; use Getopt::Long; my $age;

Not walking together with Getopt Module

2011-08-23 Thread Emeka
Hello All, Why shouldn't this work? use Getopt::Long; #$debug = 0; $result = GetOptions("age=i" => $age); if ($age) {print "Input age is $age years"; } Emeka -- *Satajanus Nig. Ltd *

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

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

Re: doubts in using Getopt in perl

2010-07-27 Thread Jim Gibson
'f=s{,}' => \...@fil); > > I want one more rename option "-r" which should be used only if "-d" > is specified ie only for directories... Please help me.. > Which Getopt module are you using? (there are 91 on CPAN). The syntax looks like Ge

doubts in using Getopt in perl

2010-07-27 Thread Sooraj S
Hi, I have a script which copies files from local machine to remote machine. parameteres : "-d" for directories, "-f" for files.. GetOptions ('d=s{,}' => \...@dir, 'f=s{,}' => \...@fil); I want one more rename option "-r" which should be used only if "-d" is specified ie only for dir

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:

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-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
that. >> >> What would be the correct method to die if one of the options is not >> complete? >> > > But they are complete.  'name' is placed in $name, '-a' is placed in $sex, > and @ARGV is left with ( '20' ). snip Good poi

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
hat 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 that. > > What would be the correct method to die if one of the options is not complete? GetOptions should print a warning and

Getopt::Long

2010-06-16 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 d

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
} stay undef and print $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/

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&

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

2008-08-04 Thread Mr. Shawn H. Corey
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 = \%cm

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

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

2008-08-04 Thread Mr. Shawn H. Corey
rint $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/pe

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

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 unde

Re: Getopt::Std and warnings

2007-12-14 Thread reader
John W.Krahn <[EMAIL PROTECTED]> writes: > On Friday 14 December 2007 09:09, [EMAIL PROTECTED] wrote: >> >> I want a warning message without having to do special coding with >> Getopt::Std. > > Getopt is one of those itches that a lot of people have

Re: Getopt::Std and warnings

2007-12-14 Thread John W . Krahn
On Friday 14 December 2007 09:09, [EMAIL PROTECTED] wrote: > > I want a warning message without having to do special coding with > Getopt::Std. Getopt is one of those itches that a lot of people have felt like scratching: http://search.cpan.org/search?query=getopt&mode=module If G

Getopt::Std and warnings

2007-12-14 Thread reader
I want a warning message without having to do special coding with Getopt::Std. I'd like for options passed to getops() with the (:) colon to give a warning message or even possibly die (Haven't decided that yet) if no argument accompanies them. But first: The Getopt::Std documentati

Re: What happened to Getopt::Std ?

2007-06-14 Thread Miguel Santinho
Em (On) Wed, Jun 13, 2007 at 09:29:27AM -0400, John Peacock escreveu (wrote): > The Kurila project is a fork of Perl5 without the strict backwards > compatibility required of v5.10.0, as a theoretical experiment. You'll note > now that under CPAN, it shows up as Is CPAN (Comprehensive __Perl__

Re: What happened to Getopt::Std ?

2007-06-13 Thread John Peacock
Mumia W. wrote: I don't know what is going on. It smells like an attempt to compromise people's systems, although it could be a mistake. Then maybe you should use Google or even look at the distro, before making wild accusations: http://www.nntp.perl.org/group/perl.perl5.porters/2007/04/msg1

Re: What happened to Getopt::Std ?

2007-06-13 Thread Mumia W.
On 06/13/2007 08:29 AM, John Peacock wrote: Mumia W. wrote: I don't know what is going on. It smells like an attempt to compromise people's systems, although it could be a mistake. Then maybe you should use Google or even look at the distro, before making wild accusations: http://www.nntp.p

Re: What happened to Getopt::Std ?

2007-06-13 Thread Miguel Santinho
Em (On) Wed, Jun 13, 2007 at 09:03:09AM +0100, Jorge Almeida escreveu (wrote): > http://search.cpan.org/search?m=module&q=getopt&s=21 What is this Perl Kurila? and why is this (apparently) creating conflicts with some namespaces? http://search.cpan.org/~tty/kurila-0_

Re: What happened to Getopt::Std ?

2007-06-13 Thread Mumia W.
On 06/13/2007 03:03 AM, Jorge Almeida wrote: http://search.cpan.org/search?m=module&q=getopt&s=21 Hmm: http://search.cpan.org/~tty/kurila-0_02/ Hmm: http://search.cpan.org/src/TTY/kurila-0_02/ It looks like this person, TTY, uploaded a modified version of Perl to his/

What happened to Getopt::Std ?

2007-06-13 Thread Jorge Almeida
http://search.cpan.org/search?m=module&q=getopt&s=21 -- Jorge Almeida -- 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,

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

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 qq(

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

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

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

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

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 gre

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: getopt

2007-01-24 Thread Chad Perrin
On Wed, Jan 24, 2007 at 06:53:53AM -0800, Tom Phoenix wrote: > > Why not simply move things to the trashcan, and skip rm altogether? Yeah . . . I'd probably solve this problem by using the mv command. If you really wanted to, you could just write a shell or Perl script called "trash" that moved

Re: getopt

2007-01-24 Thread Tom Phoenix
On 1/23/07, Tony Heal <[EMAIL PROTECTED]> wrote: The end process will be myscript.pl -rf /home/myfolder and that will pass the -rf and /home/myfolder arguments to the rm command after copying everything to the trashcan. Why not simply move things to the trashcan, and skip rm altogether? The

getopt

2007-01-23 Thread Tony Heal
I found an example using getopt on the web and I am trying to convert it to my use. Everything works except the last part. What am attempting to do is create a script which I can pass switches as arguments. Eventually this script will replace the rm command on my linux server, so that I can

RE: Getopt::Std producing unexpected results

2006-12-19 Thread RICHARD FERNANDEZ
> Getopt::Std only works with single hyphen switches, the only > exceptions being '--', '--help' and '--version'. > > perldoc Getopt::Std > > > Getopt::Std also processes swithes in clusters so "-abcd > filename" is th

Re: Getopt::Std producing unexpected results

2006-12-18 Thread John W. Krahn
RICHARD FERNANDEZ wrote: > Hi Folks, Hello, > I've written a little mytest.pl using Getopt::Std: > > > #!/usr/bin/perl > use warnings; > use strict; > use Getopt::Std; > > getopt('hl'); > our ($opt_h, $opt_l); > > my $hostname = $opt_h

Getopt::Std producing unexpected results

2006-12-18 Thread RICHARD FERNANDEZ
Hi Folks, I've written a little mytest.pl using Getopt::Std: #!/usr/bin/perl use warnings; use strict; use Getopt::Std; getopt('hl'); our ($opt_h, $opt_l); my $hostname = $opt_h ? $opt_h : undef; my $file = $opt_l ? $opt_l : undef; my @volgroups = @ARGV;

Re: hwo to configure the Getopt:::STD options for command line arguments.

2006-10-16 Thread W.P.Nijhof
). Try this use Getopt::Std; use strict; our ($opt_a, $opt_b, $opt_c); getopts( 'a:b:c:' ); print join "\n", ($opt_a, $opt_b, $opt_c); HtH WayPay -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/&

hwo to configure the Getopt:::STD options for command line arguments.

2006-10-16 Thread perl pra
hi All, I have to call some perl scripts with command line arguements from another perl script. (some thing like this) perl -s -a $ENV{X} -b $ENV{Y} -c $ENV{Z} ; ( -a , -b, -c are also the arguments to call the script) ( the $ENV{x}=C:\xyz\abc,$ENV{Y}=abc,$ENV{Z}=5). I understand we

Re: error when install GetOpt::Tabular

2006-06-28 Thread Rob Dixon
Sheng Bao wrote: > hi guys, I encountered a problem when install GetOpt::Tabular. At the first step, I stopped. Here is the error output. [EMAIL PROTECTED] Getopt-Tabular-0.3]# perl ./Makefile.PL Config.pm did not return a true value at /usr/lib/perl5/5.8.6/ExtUtils/MakeMaker.pm lin

error when install GetOpt::Tabular

2006-06-28 Thread Sheng Bao
hi guys, I encountered a problem when install GetOpt::Tabular. At the first step, I stopped. Here is the error output. [EMAIL PROTECTED] Getopt-Tabular-0.3]# perl ./Makefile.PL Config.pm did not return a true value at /usr/lib/perl5/5.8.6/ExtUtils/MakeMaker.pm line 9. BEGIN failed

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 :)

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
als sign indicates that this option requires a value. 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: Monda

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)

Re: getopt long behaviour

2005-09-09 Thread Manish Sapariya
riya 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::Long; GetOption

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
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::Long; GetOption

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. #!/us

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

Re: Getopt::Mixed

2005-04-25 Thread Offer Kaye
On 4/23/05, Carlos Mantero wrote: > Hi everybody! I'm very newbie programmer of Perl and I can't make a > little program with a small number of arguments with this Perl module, > Getopt::Mixed. I like that somebody will can make a simple program > exemple with some ar

Getopt::Mixed

2005-04-23 Thread Carlos Mantero
Hi everybody! I'm very newbie programmer of Perl and I can't make a little program with a small number of arguments with this Perl module, Getopt::Mixed. I like that somebody will can make a simple program exemple with some argument. Thanks for all. Regards, Carlos Mantero. -- To u

Re: GetOpt::Long

2005-04-22 Thread John Doe
ing "use strict" and "use warnings" which alway gives good hints :-), and it works - 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 (@recipien

RE: GetOpt::Long

2005-04-21 Thread Olivier, Wim W
tify_email { local @ARGV = @_; # 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 PROT

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

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

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

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

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

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 it to

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::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 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 > > > > > &

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::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: strict & getopt()

2004-10-17 Thread Peter Scott
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Christian Stalp) writes: >What can I do to use getopt() and use strict? >If I use strict I have to declare all of my variables. And if I do this, perl >ignores my getopt(s) single-chars. Is this normal? What can I do to solve

Re: strict & getopt()

2004-10-15 Thread Christian Stalp
> Declare your variables with our() if you're using Perl 5.6 or better; > otherwise, declare them with 'use vars'. All right, it works now, thank you very much. > If you're using Perl 5.6, don't use "-w" anymore, use the "warnings" > pragma. warnings? How does this works? #!/usr/bin/perl warnin

Re: strict & getopt()

2004-10-15 Thread Jeff 'japhy' Pinyan
On Oct 15, Christian Stalp said: >What can I do to use getopt() and use strict? Declare your variables with our() if you're using Perl 5.6 or better; otherwise, declare them with 'use vars'. >If I use strict I have to declare all of my variables. And if I do this, perl

strict & getopt()

2004-10-15 Thread Christian Stalp
Hello together, I have a new problem. What can I do to use getopt() and use strict? If I use strict I have to declare all of my variables. And if I do this, perl ignores my getopt(s) single-chars. Is this normal? What can I do to solve this? I want to use perl with "-w" opti

Re: Opening file($ARGV) with Getopt - failing

2004-09-28 Thread Chris Devers
On Tue, 28 Sep 2004, Wiggins d Anconia wrote: > On Tue, 28 Sep 2004, Chris Devers wrote: > > > On Tue, 28 Sep 2004, Errin Larsen wrote: > > > > > On Tue, 28 Sep 2004 18:51:12 +0800, Edward Wijaya > > > <[EMAIL PROTECTED]> wrote: > > > > > > > use vars qw($f); > > > > > > The above is good, b

Re: Opening file($ARGV) with Getopt - failing

2004-09-28 Thread Wiggins d Anconia
> On Tue, 28 Sep 2004, Errin Larsen wrote: > > > On Tue, 28 Sep 2004 18:51:12 +0800, Edward Wijaya > > <[EMAIL PROTECTED]> wrote: > > > > > use vars qw($f); > > > > The above is good, but is now obsolete. > > That is debatable. > Please, beginners, recognize the above word, *debatable*!! I

RE: Opening file($ARGV) with Getopt - failing

2004-09-28 Thread Bob Showalter
Errin Larsen wrote: > So, what was the justification for changing 'use vars' to 'our'? I don't know, but I suspect it's because "our" is a complement to "my". Same syntax (no silly qw() business), same lexical scoping, etc. You're correct. our() should be used and 'use vars' should be considered

Re: Opening file($ARGV) with Getopt - failing

2004-09-28 Thread John W. Krahn
Edward Wijaya wrote: > Hi, Hello, > Why my code below fail to open and > print the file contents > > when I do: > > perl mycode.pl -f filename > > > __BEGIN__ > use strict; > use warnings; > > use Getopt::Std; > use vars qw($f); > getopts('

Re: Opening file($ARGV) with Getopt - failing

2004-09-28 Thread Errin Larsen
out this issue? (I did read the link you supplied, but it didn't go into WHY this changed.) The advice I was giving in this thread was based on the following quote in my 'perldoc Getopt::Std' documentation. (A quote from that): Note that, if your code is running under

Re: Opening file($ARGV) with Getopt - failing

2004-09-28 Thread Chris Devers
On Tue, 28 Sep 2004, Errin Larsen wrote: > On Tue, 28 Sep 2004 18:51:12 +0800, Edward Wijaya > <[EMAIL PROTECTED]> wrote: > > > use vars qw($f); > > The above is good, but is now obsolete. That is debatable. Gather round, and listen to the story of a log handling utility written in

Re: Opening file($ARGV) with Getopt - failing

2004-09-28 Thread Errin Larsen
earnt much from it. > > > > > Edward, I could write this script two ways. The first is the way I > > prefer and it doesn't use 'Getopt::Std' at all: > > > I need to use Getopt, as I will increase > the number of user given options. > > Regards > Edwar

Re: Opening file($ARGV) with Getopt - failing

2004-09-28 Thread Errin Larsen
> __BEGIN__ > use strict; > use warnings; Good Start! Those pragmas above are very helpful! > > use Getopt::Std; > use vars qw($f); The above is good, but is now obsolete. The preferred method is to use 'our' declarations Also, the 'getopts()' functio

  1   2   3   >