Installing standard Unix software

I'm not sure I know the right question to ask...maybe someone can help me. What I'm eventually trying to do is to work with a Perl-based system on my Mac (Mac Snow Leopard); I need the Apache2 Perl .pm files available. They seem to be in /System/Library/Perl/Extras/5.10.0/darwin...but although this is in my path, referencing the packages as Apache2::Request (for example) does not work because of the path names of the library.

I've tried installing Apache from source, and make install appears to get confused by the fact that there's already an Apache installation that ships with the OS.

I'm sure there are lots of things I just don't understand here. Can someone point me at a resource that explains how the Apple versions of Unix software interact with potentially newly-installed versions (or explain it to me)? How much trouble can I get myself into by installing packages (Apache is the example above, but there are/may be others) that ship also with Mac OS? Should I be starting by re-installing Perl from scratch, changing my Perl include path, and pretending all the Apple software just doesn't exist? Should I just go buy a Linux box?

Thanks.

Mac OS X (10.6.1)

Posted on Nov 6, 2009 6:34 PM

Reply
13 replies

Nov 6, 2009 7:43 PM in response to etresoft

Sure. I have a large Perl system built by someone else that I'm trying to get up and running. It uses multiple "standard" packages, including things such as the Apache2 packages. I'm just trying to get the thing to start up without error (starting with resolving the various package uses). Does that help?

Nov 7, 2009 6:26 AM in response to etresoft

I have a somewhat more structured question 🙂

Does mod_perl ship with the version of Apache that ships with Mac OS? I looked for Request.pm, and found one deep in the /System/Library/Perl/Extras hierarchy, but not in the Apache2 directory - it was two levels below that directory. (That's the first error I'm getting - cannot find Request.pm). There are several other mod_perl files that don't seem to be where I'd expect them to be if the Apache install were a mod_perl install. So: if it isn't, how can I deal with this problem.

Second question: same question for XML::LibXSLT, which also does not seem to be there.

Thanks.

Nov 7, 2009 10:20 AM in response to rm50

rm50 wrote:
I have a somewhat more structured question 🙂


Thanks. This is much better. 🙂

Does mod_perl ship with the version of Apache that ships with Mac OS? I looked for Request.pm, and found one deep in the /System/Library/Perl/Extras hierarchy, but not in the Apache2 directory - it was two levels below that directory. (That's the first error I'm getting - cannot find Request.pm). There are several other mod_perl files that don't seem to be where I'd expect them to be if the Apache install were a mod_perl install. So: if it isn't, how can I deal with this problem.


Yes. It needs a little bit of configuration. I just setup mod_perl on my 10.6 test machine. This is the first time I have ever setup mod_perl. It seems to work fine.

I added the following to /etc/apache2/httpd.conf

LoadModule perl_module libexec/apache2/mod_perl.so
Alias /perl/ /Library/WebServer/perl/
PerlModule ModPerl::Registry
<Location /perl>
SetHandler perl-script
PerlHandler ModPerl::Registry
Options ExecCGI
PerlSendHeader On
allow from all
</Location>


then I created a perl directory at '/Library/WebServer/perl' as directed by mod_perl in 30 minutes. It is quicker than 30 minutes. Also, that web page is really out of date. I had to modify my config file and my mod perlrules2.pl script. Here is my new script:

my $r = Apache2::RequestUtil->request;
$r->content_type("text/html");
$r->print("mod_perl rules!");


Second question: same question for XML::LibXSLT, which also does not seem to be there.


I do not seem to have this module either. I suppose all you need to do is install it via CPAN.

That is all I can do for now. My 10.6 machine is low on battery....

Nov 7, 2009 11:26 AM in response to etresoft

That was unbelievably helpful, thanks! That would have taken me ages, or I would have given up. I'm sure I'll have more questions as I move along, but at least I'm moving.

I do have one general question, though. Where can one find the cheat sheet that translates between the standard (more or less) Unix filesystem and the Mac OS filesystem? For example, you put the perl directory in /Library/Webserver instead of in /home/httpd. Why? In general, I have a very hard time on Mac OS figuring out where stuff is (compared to where I'd think it might be on a Unix system, although my Unix knowledge is somewhat dated as well).

Thanks again.

Nov 7, 2009 11:39 AM in response to rm50

rm50 wrote:
I do have one general question, though. Where can one find the cheat sheet that translates between the standard (more or less) Unix filesystem and the Mac OS filesystem? For example, you put the perl directory in /Library/Webserver instead of in /home/httpd. Why? In general, I have a very hard time on Mac OS figuring out where stuff is (compared to where I'd think it might be on a Unix system, although my Unix knowledge is somewhat dated as well).


Ubiquitous is not the same as standard. MacOS X is a UNIX operating system. Linux is not. However, the UNIX standard doesn't specify where Apache web documents go. You can put them wherever you want.

For this particular example, I didn't know off the top of my head. I was editing the Apache config file and it is defined right in there.

But you are correct in that many MacOS X files aren't in the same locations as on Linux. Some of them are, but not all. It is more of a philosophical difference than anything else. In Linux, the expectation is that you are willing and able to rebuild Apache (or some library) on a moment's notice to get random odd things working. On MacOS X, you don't do that. You don't have as much control over the system files. You can modify them if you really need to, but in most cases, there is a better way.

Nov 7, 2009 12:39 PM in response to etresoft

So of course I do have more questions...sorry.

First, the Apache2::Request library is still (not surprisingly) not findable by Perl, since it doesn't live in my standard INC. That seems odd (it lives in /System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level/DBI/Gofer). Is there something going on, or should I just make sure my @INC points there?

Also, when I tried to install XML::LibXSLT, the perl makefile complains that I only have version 1.69 of LibXML, not 1.70. Can I safely install the 1.70 LibXML.pm on top of the 1.69 that lives in my system area, or should I put it somewhere in my INC path before the system version? What would you suggest?

Thanks (again).

Nov 7, 2009 1:47 PM in response to rm50

rm50 wrote:
First, the Apache2::Request library is still (not surprisingly) not findable by Perl, since it doesn't live in my standard INC. That seems odd (it lives in /System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level/DBI/Gofer). Is there something going on, or should I just make sure my @INC points there?


It doesn't live there. It isn't installed at all. I had to install it via:
sudo perl -MCPAN -e 'shell'
install Apache2::Request

At some point, it stopped and asked me if I wanted to run the tests. The first time I accepted the default and the tests failed. Then I did the install again and it quickly got back to the point of asking about the tests. This time, I told it to skip the tests. Those CPAN tests often fail due to very specific configurations required.

Then I added a new script to test this module:

use Apache2::Request;
$req = Apache2::Request->new($r);
@foo = $req->param("foo");
$bar = $req->args("bar");
$req->content_type("text/html");
$req->print("Bar is $bar ");

It failed. After a little Googling it appears you need a specific module to support this. That module seems to be there already, so I added it to /etc/apache2/httpd.conf.

LoadModule apreq_module libexec/apache2/mod_apreq2.so

Restarted Apache and it worked this time. Moving on...

Also, when I tried to install XML::LibXSLT, the perl makefile complains that I only have version 1.69 of LibXML, not 1.70. Can I safely install the 1.70 LibXML.pm on top of the 1.69 that lives in my system area, or should I put it somewhere in my INC path before the system version? What would you suggest?


Actually, that was just a warning. I let CPAN run and I now have LibXML. CPAN appears to put things into /Library/Perl. That seems like a logical place. On MacOS X, while there is a /usr directory, there is also a MacOSX equivalent /System. The same goes for /usr/local. Things that you might expect to go into /usr/local might sometimes be in /Library. I guess it depends on how "Mac-friendly" a particular package might be. Many are too difficult to reconfigure and are better left to /usr or /usr/local. I haven't tested XSLT or XML because I don't have any XSL files handy on this machine. But I don't expect it to have problems.

Keep in mind that if you intend to deploy anything on a different system (such as a shared hosting provider), that other system must have the same modules. The big web hosting companies usually have all the bells and whistles, but you never know. You usually cannot install Apache modules or make most system configuration changes on a shared provider.

You can install CPAN modules anywhere you want and tell Perl about the new library path. I normally do that rather than just letting CPAN do it all, but this is a throwaway 10.6 install on this machine so I don't care. I like to keep my Perl projects as self-contained as possible. I don't think that is really possible with mod_perl though.

Nov 7, 2009 2:26 PM in response to rm50

Not really, these days the web has so much misinformation that it really isn't very helpful anymore. Lots of what you will find is Linux-specific. That can be helpful if you know how to translate into MacOSX, but it takes time to learn.

I think these forums would be your best place to ask questions. You have just about exhausted my knowledge of mod_perl. If you have more detailed questions I wouldn't be able to help. There are other people here that know much more about Apache on MacOS X than I do.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Installing standard Unix software

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.