in reply to command prompt help

If you are using CGI.pm (You are, aren't you???) it will ask you to enter your name/value pairs when you run it from the command line. If you aren't using CGI.pm for this, you should be.

Cheers,
KM

Replies are listed 'Best First'.
RE: Re: command prompt help
by Anonymous Monk on Jun 07, 2000 at 00:57 UTC
    <rant> Why does everyone swear by CGI.pm? For many simple CGI scripts, it is simply overkill. I use a simple little subroutine that creates a hash out of all the name/value pairs at it works fine. </rant>

    I think perhaps the author of the question was wondering how to access command line arguments, and was merely using the CGI example to illustrate what he was saying.

    If so, Perl stores command-line arguments in the @ARGV array.

    If you want to simply treat all the arguments as one, you can just do:

    $arguments = join(' ', @ARGV); # do something with $arguments
    If you want to examine each argument in turn, you can just do:

    foreach $argument (@ARGV) { # Do something with $argument }
      i've been wondering the same thing...i just recently started doing more CGI work, having been doing java abstraction stuff, as well as sysadmin.

      unless you're doing lots of form handling, it seems like major overkill just to parse one QUERY_STRING. and remember the syntax of h1 for you.

      michael d. ivey, <ivey@gweezlebur.com>

      First, CGI.pm will parse the QUERY_STRING so you don't need to, and likely more cleanly than you. Secondly, your little lines of code above will not work with CGI scripts. Why would someone even try to use @ARGV with CGI? Currently, CGI.pm may be slightly bulky, but it does its job well, is maintained, and if it is so expensive for you to use, you need to upgrade your hardware.

      Cheers,
      KM