in reply to Passing a query string from a command line (Win32)

There is if you're using CGI.pm. From the POD for CGI:

DEBUGGING
If you are running the script from the command line or in the perl debugger, you can pass the script a list of keywords or parameter=value pairs on the command line or from standard input (you don't have to worry about tricking your script into reading from environment variables). You can pass keywords like this:

your_script.pl keyword1 keyword2 keyword3

or this:

your_script.pl keyword1+keyword2+keyword3

or this:

your_script.pl name1=value1 name2=value2

or this:

your_script.pl name1=value1&name2=value2

Dave

Replies are listed 'Best First'.
Re^2: Passing a query string from a command line (Win32)
by slloyd (Hermit) on Oct 29, 2005 at 13:52 UTC
    My script does use cgi but when it is run from the command line it returns different results than if run from a browser. Is there a way to trick a script to think that is was run from a browser? How does Apache or other web servers open the script and get results? What do they do different? Aren't they reading from STDOUT also? Isn't there a way to simulate a web server to get the 'web' results of a single script?

      If you find downloading, setting up and maintaining Apache is daunting, or like me, just a pain in the artic, take a look here.

      70k to download, setup consists of 2 options and it does most of what apache does.

      Probably not good for running your multinational conglomorate, but for testing your scripts at home...


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
      Hi slloyd,

      When I was in your position I installed Apache. Why try to simulate one when you can have the real thing?

      Hope that helps