[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Testing CGI scripts Offline



Re: Running and testing CGI scripts on a single Mac,
offline--

Matt Neuburg (author of "Frontier, The Definitive Guide"
and luminary of the TidBits email list) suggested, for
testing cgi scripts offline, creating a TCP/IP
configuration using AppleTalk/Mac IP.

I'm a newbie at Perl (THANK YOU, Vicki and Chris, I love my
copy of "MacPerl, Power and Ease"! :-), but to develop and
test Perl cgi scripts on my own Macintosh (a stand-alone,
un-networked machine) without being connected to the
Internet, I follow Matt's suggestion:

--My Tools: 
* Macinosh, using Open Transport. 
* MacPerl (with BBEdit) to create cgi scripts. 
* MacHTTP web server installed (and easily configured) on my 
Mac. 
* Netscape WWW browser.

--Preparation: 
* In MacPerl, when I wish to test a script I have worked 
on, I "Save As..." a cgi script. 
* MacHTTP serves documents only from within its own folder, 
so I copied the folder of my website-in-development (and all 
of its files and subfolders) into the MacHTTP folder. I
created a "cgi-local" folder within the website-in-development 
folder, and that is where I save a copy of my MacPerl cgi 
scripts.

--Creating the "fake" network configuration: 
* Open the TCP/IP control panel. 
* Choose File menu-> Configurations... 
* Highlight the "default" (or another) configuration, and 
click the "Duplicate..." button. Name the new configuration 
something meaningful, like "AppleTalk/MacIP cgi testing." 
* Highlight the new configuration and click the "Make Active" 
button. 
* Because the new configuration will use AppleTalk, choose 
Apple menu-> Chooser, and for AppleTalk, click the "Active" 
button. 
* In the TCP/IP control Panel (which now represents the new 
configuration, the name of which should appear in the control 
panel's title bar), for "Connect via:" choose 
"AppleTalk (MacIP)." For "Configure:" choose "Using MacIP 
Manually." For "IP Address:" type an arbitrary numeric IP 
address (I use 1.1.1.1). Close the TCP/IP control panel, and 
when prompted, Save changes.

--Using the "fake" network connection, offline: 
* Make sure that your "fake" configuration (that uses 
AppleTalk(MacIP)) is currently active in the TCP/IP control 
panel (File menu-> Configurations...). 
* Launch the Web Server (such as MacHTTP) on your Mac. 
* Launch your WWW browser. 
* Use the WWW browser to retrieve or request your HTML 
documents or cgi scripts. Because I use the arbitrary IP 
address of 1.1.1.1, the URLs I type look something like this:

http://1.1.1.1/my_website_folder/a_cgiscript-calling_form.html

-or-

http://1.1.1.1/my_website_folder/cgi-local/my_cgi_script.pl

(or my_cgi_script.cgi)

---
When you are done testing, Quit your WebServer, remember to
turn AppleTalk off (if you don't normally use it) in the
Chooser, and select your usual configuration in the TCP/IP
control panel, so that you can connect to the Internet in
your usual way.

Best wishes, Steve Doonan, New Mexico US



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch