in reply to Re: Re: Re: Parsing command line
in thread Parsing command line

My fault, I wasn't clear enough. I wrote a command line interface to our product in my company. The parsing isn't working with spaces within it. from the Linux shell command line it works.
Linux prompt>myprog Welcome to my program !!! myprog prompt> set -message "hello world" # this doesn't work
I hope now the question is clearer.

Hotshot

Replies are listed 'Best First'.
RE(5): Parsing command line
by Tomte (Priest) on Aug 26, 2002 at 13:52 UTC
    I hope now the question is clearer.

    Not really ;-)
    is myprog a shell-script, that starts perl-programs or a perl-program internally using input via STDIN to feed Getopt::Long?

    I'm sorry to say, more than ever: without actual code with the right context, I for one can't help you any further,

    If it is a bash-script calling a perl-script, it's with a high probability a quoting-problem.
    regards,
    tomte


      sorry again, myprog is a perl script that starts ap perl program using input via STDIN as you said.
      here is some more code:
      # main perl script my $input; # defining ReadLine module for supporting my $term = new Term::ReadLine 'Command Line Interface'; print "\nWelcome to my command line interface (version $version)!\n\n" +; while (defined($input = $term->readline("\n" . $prompt.' (main, exit, +back, help) > '))) { chomp $input; $input =~ s/^\s+//; # delete leading spaces $input =~ s/\s+$//; # delete trailing spaces &parseCmdLine(); ... } sub parseCmdLine { ... local %hash; if (GetOptions(\%hash, 'netbios=s', 'winbind!', 'srvstring=s')) { &doSomething(); } ... }


      Hotshot
        Ok, I assume I got you wrong again...;-)

        I figured you have to overwrite @ARGV to get GetOptions to work with you local data. I played a bit with the possibility to turn $input into an array. Unfortunatly I have a meeting right now, I'll get back to it this evening, if you still need help then...

        regards,
        tomte