I am trying to send a get or a post through a command-line argument. That is test the script in the command line before I test through a browser (the server has issues). I tried searching online, and I suppose I was probably using incorrect terminology because I got nothing. I know this is possible because I saw someone do it. I just don't remember how it was done.
Thanks! :)
Are you using the standard CGI module?
For example, with the following program (notice -debug
in the arguments to use CGI
)
#! /usr/bin/perl
use warnings;
use strict;
use CGI qw/ :standard -debug /;
print "Content-type: text/plain\n\n",
map { $_ . " => " . param($_) . "\n" }
param;
you feed it parameters on the command line:
$ ./prog.cgi foo=bar baz=quux Content-type: text/plain foo => bar baz => quux
You can also do so via the standard input:
$ ./prog.cgi (offline mode: enter name=value pairs on standard input; press ^D or ^Z when done) foo=bar baz=quux ^D Content-type: text/plain foo => bar baz => quux