Re: Simmulation of cgi scripts, offline.
by arturo (Vicar) on Sep 28, 2001 at 19:28 UTC
|
You're in luck. CGI.pm is built to allow testing of CGI scripts from the command line. You can save, and load, query objects from files, or you can type in the name-value pairs on the command line. See perldoc CGI on your system and search for "command line" (the default handling changed recently, so I've heard), and
read the section "CREATING A NEW QUERY OBJECT FROM AN INPUT FILE" for info on how to load a query from a file.
HTH.
perl -e 'print "How sweet does a rose smell? "; chomp ($n = <STDIN>);
+$rose = "smells sweet to degree $n"; *other_name = *rose; print "$oth
+er_name\n"'
| [reply] [d/l] [select] |
Re: Simmulation of cgi scripts, offline.
by tachyon (Chancellor) on Sep 28, 2001 at 19:31 UTC
|
Yes install Apache web server - you can do this on *nix and Win32. You will then have a real CGI environment. Assuming you are on Win32 (just a guess) do a Google Web Search for "Apache CGI Win32 Perl" to find some how to's - a lot of them deal with PHP but the principle is identical. Here is one example Installing Apache and Perl on Win32
Alternatively you could use an IDE like PerlBuilder 2 which is an expensive commercial Perl IDE product that has a CGI simulation. You can get the free demo from www.solutionsoft.com
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
| [reply] |
Re: Simmulation of cgi scripts, offline.
by gryphon (Abbot) on Sep 28, 2001 at 19:44 UTC
|
Greetings Baz,
I use a combination of two tools. First, install ActiveState's Perl for Windows. (I know this sounds obvious, sorry. Just covering all the bases.) Then check out Xitami, a cute little HTTP server for your PC. Why did I pick Xitami over Apache? Well, when I'm playing with CGIs on my local system, I'm typically building personal stuff. I don't need the raw power and coolness of Apache. Xitami is an "install and forget" sort of Web server. It handles CGI nicely as well as aliasing and other stuff. I wouldn't recommend it for anything other than a development "play" server, though.
-gryphon
code('Perl') || die;
| [reply] |
|
|
| [reply] |
Re: Simmulation of cgi scripts, offline.
by the_slycer (Chaplain) on Sep 28, 2001 at 19:27 UTC
|
Get a webserver :-)
You cannot use the browser to run a cgi script without a server, this simply cannot be done.
The other option is to run your cgi script from the command line, on a properly configured system it should prompt you to input the key/value pairs that you would be passing via the form. If you run it like so and pipe the output to a file you can be able to load the file with the results into the webbrowser. | [reply] |
Re: Simmulation of cgi scripts, offline.(install a server)
by mandog (Curate) on Sep 28, 2001 at 19:41 UTC
|
baz asks here: I was wondering is it possible to simulate a cgi environment on my pc.
I agree with the_slycer It would be easier to install apache or Microsoft Personal Web Server.
You get to look at all the logs...
From scratch, without prior experience and with mid level tech skills, it took me about 8 hours to install IIS and 8 hours to install and configure apache. It was well worth the effort.
If you are running win95/win98/ME your mileage may vary. I've heard people have trouble getting perl scripts to run as easily. (Though I think Windows Apache can be configured to use the !# line)
update: Of course if you are exposing a service to the outside world, you want to be sure that you have installed all the security patches for your OS...Especially if you are running a Code Red or Mimda vunerable OS
--mandog
| [reply] |
|
|
On Windows, it would probably be easier to install Indigoperl. This installs Perl 5.6.1 and Apache.
Simon Flack ($code or die)
$,=reverse'"ro_';s,$,\$,;s,$,lc ref sub{},e;$,
=~y'_"' ';eval"die";print $_,lc substr$@,0,3;
| [reply] |
|
|
| [reply] |