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

Re: [MacPerl-WebCGI] MacPerl CGI's not editable via ftp?



>Is there a way to configure webstar to use the Perl program as an 
>interpreter for a plain text perl program the way that UNIX 
>webservers do?


(I apologize to regular readers for reposting this, but what can I do?)


Short answer: No.

More useful answer: if you are willing to make some adjustments as to 
how you run the CGIs, and depending on how you are using them (e.g. I 
would not do this on a public server) there is a work-around.  Given 
a URL like:

http://example.com/cgi-bin/dispatcher.cgi$text_script.plx

...where dispatcher.cgi is the appended script saved as "CGI Script" 
and text_script.plx is your users' script saved as plain text, 
text_script.plx will be executed and its output returned to the 
browser.

HTH

-David-

---=== BEGIN MacPerl SCRIPT ===---

#!/usr/bin/perl
#
# cgi_dispatch.cgi
# by David Steffen
# Last Modified 03/29/2000
#
# Perl CGI Script which implements a dispatcher
# ... for multiple, virtual CGIs.
#
# In this version, $do_what corresponds to the
# ...full path from the base HTML directory to the
# ...name of a perl script to be executed as a virtual
# ...CGI and is passed in $ENV{PATH_INFO}

# This next value needs to be set for your server
# It is the full path to the home CGI directory
$home_dir = 'Tyrosine:Documents:Quid Pro Quo:html:cgi-bin';

# Get the path to the script to be executed
$do_what = $ENV{"PATH_INFO"};
# ...add the rest of the full path
$inpfile = $home_dir . ':' . $do_what;
# ...and open the file.
open(INFILE, $inpfile) || die "Can't open $inpfile: $!";
# Convert Unix or PC newlines to Mac if necessary
@lines = <INFILE>;
$script = join('', @lines);
$script =~ s/\x0D?\x0A/\x0D/g;

# Run the script
eval $script;
# Display any execution errors to the user.
# (Good for students, but maybe not for users.)
print $@ if $@;

exit 0;

__END__

---=== END MacPerl SCRIPT ===---
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