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

Re: [MacPerl-WebCGI] Testing scripts in a Mac



>is there a way to TEST your .pl scripts OFFLINE, inside
>my Mac, without having to put them in a server or having to be connected
>to a network?
>
>The only ways I've been able to figure out, by browsing endless hours
>through the FAQ archives, imply either sacrificing 700MB of disk space
>to install Linux in your Mac or being at least connected to a Network
>and using Apple's Personal Web Sharing.

Apple's Personal Web Sharing works fine, as do most (or all) of the 
other Mac web servers, which cost from $0 to hundreds of dollars.

I'm 99.9% sure you don't need to be connected to a network, but all 
my Macs are at the moment so I can't test that, nor do I exactly 
remember how you set up your Mac.  This has been discussed here 
several times recently, and hopefully someone else will chime in with 
the answer.

>There's got to be a way to mimic or fake an Unix Environment in a Mac,
>no?

That's a somewhat different question.

It is my contention that for almost all well written CGI's, you don't 
need to do that.  MacPerl and *nix (Unix, Linux, BSD, ...) Perl are 
extremely compatable.  The major "incompatability" is that *nix Perls 
can call programs on the *nix system which are not available on the 
Mac.  My "well written" qualification refers to the fact that 
personally, I think the security and portability complications of 
such system calls outweigh their benefits, given that there is little 
you cannot do from within Perl.  Given that, and assuming you have 
installed MacPerl and have Apple's Personal Web Sharing or some other 
Mac Web server up and running on your Mac:

1) Find out what the path to perl is going to be on your *nix server 
(e.g. using the "which perl" command) and, assuming it is 
/usr/bin/perl, include the following as the first line in your 
MacPerl CGI:

#!/usr/bin/perl

2) For testing, Use "Save As" from the MacPerl application File menu 
to save your script as "cgi".  Save the script, with the extension 
.cgi, someplace where your Mac Web server can find it.  (.acgi and 
server push are advanced topics not discussed in this message.)

3) Once you are happy with the CGI, so another Save As, but to a text 
file.  Transfer it to the *nix server, using a text transfer, put it 
in the correct location for its webserver, and you are done.

-David-
David Steffen, Ph.D.
President, Biomedical Computing, Inc. <http://www.biomedcomp.com/>
Phone: (713) 610-9770 FAX: (713) 610-9769 E-mail: steffen@biomedcomp.com

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org