PDA

View Full Version : Documentation and Functionality oddities with Perl on OSX


pontifex
03-08-2007, 07:48 PM
Recently I’ve been looking to code my own Perl scripts for MacOSX. I’ve asked (http://forums.macosxhints.com/showthread.php?t=66377) about (http://forums.macosxhints.com/showthread.php?t=66222) doing scripts before, but this is the first time that I’ve actually sat down to write one.

I seem to be having some issues with Perl on OSX. In this ( http://forums.macosxhints.com/showthread.php?t=66222) thread Hayne (Thanks for all the help!), uses ‘use Mac::Files’ to get at some Mac specific routines that would seem to make life easier for me. But he also suggests doing a ‘perldoc Mac::Files’, which does not work on my machine!


perldoc Mac::Files
No documentation found for "Mac::Files".


From what I’ve been able to glean, Mac::Files is part of Mac-Carbon ( http://search.cpan.org/~cnandor/Mac-Carbon-0.77/), a third party suite of modules for interfacing with the OSX carbon API. It looks as if Hayne expected it to be installed by default…

It would seem to be a perfectly suitable set of modules to have bundled with the stock Perl installation I’ve seen on my computer, but it does not seem to be installed as of yet. Is this normal?

I’ve verified that Perl is indeed installed and “working” on my machine, but I’ve been hesitant to use it as of yet because it seems incomplete. When reading the man page (http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/perl.1.html), I’ve found several references to inaccurate information. For instance, the man page cites that perl documentation lives in /usr/local/lib/perl5/man directory, but I don’t have one. Instead it seems to be in /System/Library/Perl/5.8.1, along with other crucial modules.

So really a pointer to some coherent documentation about Perl on Mac would be of great help. Some tool to check if my Perl is functioning correctly would be helpfully as well.

Thanks for helping to put my mind at ease.

--Pontifex

hayne
03-08-2007, 08:27 PM
But he also suggests doing a ‘perldoc Mac::Files’, which does not work on my machine!


perldoc Mac::Files
No documentation found for "Mac::Files".

The documentation is in the file:
/System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level/Mac/Files.pod
Do you not have this file on your Mac?
This file seems to have been installed as part of the DevDocumentation.pkg which I assume is part of the developer tools install.
Do you have the Apple developer tools (Xcode Tools) installed? (It is an optional install from the Tiger DVD)

From what I’ve been able to glean, Mac::Files is part of Mac-Carbon ( http://search.cpan.org/~cnandor/Mac-Carbon-0.77/), a third party suite of modules for interfacing with the OSX carbon API. It looks as if Hayne expected it to be installed by default

Indeed. On my 10.4.8 machine, the Mac::Files module seems to have been installed as part of the "Essentials" package that comes with OS X.
The relevant file is:
/System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level/Mac/Files.pm

I get this information by running the 'grep_pkg' script (available from http://hayne.net/MacDev/Bash/) to look for that file in the receipts files under /Library/Receipts:

% grep_pkg /System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level/Mac/Files.pm
./System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level/Mac/Files.pm 100644 0/0 28624 3075931437
*** Essentials.pkg ***
------------------------------


When reading the man page (http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/perl.1.html), I’ve found several references to inaccurate information. For instance, the man page cites that perl documentation lives in /usr/local/lib/perl5/man directory, but I don’t have one. Instead it seems to be in /System/Library/Perl/5.8.1, along with other crucial modules.

Much of the documentation that comes with the open-source software that is bundled with OS X is unmodified from the standard, generic version that in the public distribution of that open source software.
Such would seem to be the case for the Perl docs that you referred to above. This is a normal fact of life on OS X and does not indicate in any way that your Perl installation is incomplete.