Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > Getting Perl installed in OS X

Getting Perl installed in OS X
Thread Tools
wclarkson
Dedicated MacNNer
Join Date: Mar 2001
Location: New Orleans
Status: Offline
Reply With Quote
Aug 21, 2001, 01:30 PM
 
Right now I'm learning PERL. I thought perl was installed with OS X. But I guess I was wrong. After Getting the path to perl (from another thread) I inserted that into my .pl file. It now just displays the source See The Example Here.

I am wondering what I need to do to get PERL installed and working in OS X.

Any help would be apprecitated.
G4 Cube Owner :-)
     
honeydew
Dedicated MacNNer
Join Date: Apr 2001
Location: San Francisco, USA
Status: Offline
Reply With Quote
Aug 21, 2001, 02:23 PM
 
Have you installed the developer tools?

<font face = "courier">% where perl
/usr/bin/perl</font>

This is a simple test to see if you have perl installed. If <font face = "courier">where perl</font> does not print anything, perl is missing and you should install the developer tools. Download the latest tools from http://connect.apple.com/ if you have a fast connection, otherwise use the CD.

If you have perl and your program still is not behaving, then you are probably just forgetting a few technicalities. Let's say you have your perl program
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
#!/usr/bin/perl

print <font color = red>"Perl on Mac OS X\n"</font>;
</font>[/code]
in a file called <font face = "courier">hello.pl</font>. Here's how you execute it

<font face = "courier">% chmod 755 hello.pl
% ./hello.pl
Perl on Mac OS X
%</font>

Remember the <font face = "courier">%</font> character represents the command prompt and should not be typed. Hope this helps.
     
Lordie
Fresh-Faced Recruit
Join Date: May 2001
Status: Offline
Reply With Quote
Aug 21, 2001, 02:28 PM
 
Did you check in /usr/bin to see if perl was there?
Can you run
&gt; /usr/bin/perl -v
and receive output? Does it say
"This is perl, v5.6.0 built for darwin" ???

If you see the above message, just type
&gt; perl perl.pl
and your little program should run...
conversely you can
&gt; chmod +x perl.pl
&gt; ./perl.pl
and the script will actually use your she-bang(#!...) to find perl.
     
wclarkson  (op)
Dedicated MacNNer
Join Date: Mar 2001
Location: New Orleans
Status: Offline
Reply With Quote
Aug 21, 2001, 02:48 PM
 
Originally posted by honeydew:
<STRONG>Have you installed the developer tools?

% where perl
/usr/bin/perl</STRONG>
No I have not installed developer tools. because they don't launch in my version of OS X

/usr/bin/perl -v

The /usr/bin/perl -v worked.

but the rest didn't.

It said "./perl.pl: Command not found."

I am actually doing this on a developer build...in case this makes a difference.
G4 Cube Owner :-)
     
larkost
Mac Elite
Join Date: Oct 1999
Location: San Jose, Ca
Status: Offline
Reply With Quote
Aug 24, 2001, 11:35 PM
 
If perl -v is working, than perl is fine. I am guessing that your problem is that you are trying to make a Perl CGI, and you are not putting it in the /Library/WebServer/CGI-Executables/ directory. You need to put your perl CGI's there, and they will then show up on your web server as being in:

http://your.host.name.here/cgi-bin/

Apache is not setup to work with any scripts outside of the cgi-bin directory by default, and this is a security measure. I will leave it to you to figure out how to enable it elsewhere if you want to. This is standard behavior.
     
wclarkson  (op)
Dedicated MacNNer
Join Date: Mar 2001
Location: New Orleans
Status: Offline
Reply With Quote
Aug 25, 2001, 12:29 AM
 
Thanks a lot....That helped...now its just getting them to run.

I get an internal server error 500 error.

i made these in BBEdit.

Code

#!/usr/bin/perlprint "Will";
I get the following error:

Internal Server ErrorThe server encountered an internal error or misconfiguration and was unable to complete your request.Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error.More information about this error may be available in the server error log

The Perl script is available at:
http://www.willclarkson.com/cgi-bin/will.cgi

Thanks in advance for any help.
G4 Cube Owner :-)
     
gorgonzola
Admin Emeritus
Join Date: Nov 2000
Location: New Yawk
Status: Offline
Reply With Quote
Aug 25, 2001, 03:28 PM
 
Try this.

Open TextEdit/BBEdit/Emacs/whatever and paste in the following:

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>#!/usr/bin/perl

print <font color = red>"Content-type: text/html\n\n"</font>;
print <font color = red>"&lt;!doctype html <font color = green>public</font> \"</font>-<font color = brown>//W3C/DTD HTML <font color = blue>4.0</font>/EN\<font color = red>"&gt;\n"</font>;</font>
print <font color = red>"&lt;html&gt;\n"</font>;
print <font color = red>"&lt;title&gt;testing&lt;/title&gt;\n"</font>;
print <font color = red>"&lt;body&gt;\n"</font>;
print <font color = red>"&lt;h3&gt;testing&lt;/h3&gt;\n"</font>;
print <font color = red>"&lt;/body&gt;"</font>;
print <font color = red>"&lt;/html&gt;"</font>;

exit <font color = blue>0</font>;</font>[/code]

Now put it in <font face = "courier">/Library/WebServer/CGI-Executables/</font> and call it test.pl. test.cgi will work as well.

Now change the permissions on the file:

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>[localhost:/Library/WebServer/CGI-Executables] username% chmod <font color = blue>755</font> test.pl</font>[/code]

Now open your web browser and go to http://localhost/cgi-bin/test.pl (or test.cgi if you called it that).

If that doesn't work, then stop using internal developer builds and get the GM and install the Developer Tools like a normal person..

[ 08-25-2001: Message edited by: gorgonzola ]
"Do not be too positive about things. You may be in error." (C. F. Lawlor, The Mixicologist)
     
wclarkson  (op)
Dedicated MacNNer
Join Date: Mar 2001
Location: New Orleans
Status: Offline
Reply With Quote
Aug 25, 2001, 03:38 PM
 
Thanks gorg...actually before u replied...I had figured it out...Through the help of some very nice forum members (you know who you are).

I got it....now on to learning how to use it....
G4 Cube Owner :-)
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 05:00 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,