[sf-perl] perl on a mac
danlyke at flutterby.com
Sun Nov 16 09:16:10 PST 2008
On Sun, 16 Nov 2008 07:22:21 -0800
Walt Sanders <wsanders at pacificwebdesign.org> wrote:
> Terminal won't run it of course, it just spits that code back at
> me. But, if I try to run it in a browser, of try to preview it in an
> editor, it still spits code back at me. This is any program that
> runs perfectly fine when I upload it to any one of my ISP servers.
Right. You need to either:
1. Pipe the output to an html file (although you'll need to strip the
"Content-Type: text/html\n\n" first two lines). For instance:
stuff.cgi > output.html
perl -npi.bak -e 's/^Content-Type: .*$//;' output.html
And then open output.html in your web browser. If this is a Mac, you
could do "open output.html", on a Gnome based Linux machine, you'd
do "gnome-open output.html". Or, in either machine (or even Windows),
you can have that folder opened and double-click on output.html.
2. Run this under a web server on your local machine.
> I can just download any working .cgi or .pl from one of my
> websites and it won't run on my machine.
When you say "won't run", what's the *exact* (copied and pasted) output
you get from one of these programs. Does it look like:
danlyke at danhplaptop:~$ ./test.pl
bash: ./test.pl: /usr/share/perl: bad interpreter: No such file or
directory danlyke at danhplaptop:~$
If so, then the Perl interpreter on your web server is in a different
place than on your Mac. However, it's fairly clear that you're a
relative newbie (no harm in that, just gotta be more specific), so
phrases like "Doesn't work" and "won't run" don't help us to debug the
problem for you.
More information about the SanFrancisco-pm