OS X 10.4 shipped with 5.8.6, which is what he has.

I think some of the misunderstanding is from Terrence's inexperience with perl. Terrence, the modules you're missing aren't missing because you don't have "a full version of perl". They're probably missing because they weren't included in the base distribution of perl for version 5.8.6.

One of perl's great strengths as a programming language is that there is a library of modules called the Comprehensive Perl Archive Network (CPAN, for short) that allows programmers to build on the efforts of others without having to re-invent the wheel. The modules you're missing are modules to do things like build HTML documents and communicate via web protocols.

Anyway, from time to time, modules are added to the base install, so there are modules that come standard with 5.8.8 and 5.10.1 that weren't standard with 15.8.6. It may also be that Apple decides to add modules to the perl it's delivering with OS X.

Anyway, none of this is really a problem, since you can install the modules you need, and things should just work.

Here's some commands that will help you:

    $ head -1 get_iplayer

This will tell you which perl of yours the iplayer is using. The one I'm using says /usr/bin/perl, but you may have modified yours.

    $ which perl

This shows you which perl you're using by default. If it shows the same perl as the one iplayer is using, you don't need to type the full path when referring to perl when you want to add modules.

    $ sudo /usr/bin/perl -MCPAN -e shell

This will run the CPAN shell, which will allow you to install modules in the library used by /usr/bin/perl. If you're using a different perl than that one, use that path.

    cpan> install LWP
    cpan> install Fcntl
    cpan> install HTML
    cpan> install HTTP

These commands tell the CPAN shell to install those modules.

Again, I don't think you're going to solve your problem under OS X 10.4 Tiger without installing the modules you're missing, because I don't think your problem is that you don't have "a full version of perl". I think the problem is that Apple decided to add optional modules to 10.5 that they hadn't added to 10.4 and aren't part of the base perl install. You can easily add these modules through the CPAN shell, however, so your solution should probably be that.

Or upgrade to OS X 10.5. I did that this past weekend to my G4 Powerbook. Yes, I know I'm a full rev behind, but better late than never.


On Sep 14, 2009, at 8:04 AM, Mine wrote:

Thank you for the very informative response Alan.

I think the problem is probably to do with my Perl install. I looked in /System/Library/Perl/ but the Perl folder contained 5.8.6 not 5.8.8. I could not find any of the following:

I previously installed some applications using MacPorts, and it appears that there is an
install of Perl 5.8.8 in /opt/local/bin/.

Over the weekend still trying to solve the problem I also installed Perl 5.10.1 in an attempt
to upgrade my system Perl install. That is in /usr/local/bin/.

I also searched /usr/local/lib/perl5/5.10.1/ and /opt/local/lib/ perl5/5.8.8/ and it would appear that the MacPorts install is the most complete but I could not find an LWP directory or HTTP, and I was not sure where to look for URI. The HTML directory contained entities.pm, and
headerParser.pm but no Cookies

Is it possible to upgrade the system Perl install to a full version of Perl 5.8.8?



On 14 Sep 2009, at 11:09, Alan Fry wrote:

On 13 Sep 2009, at 03:46, Doug McNutt wrote:

At 23:22 +0100 9/12/09, Mine wrote:

Thanks for your excellent response, makes installing so easy assuming I did it correctly. I think everything that was required is installed, but I am not sure everything was installed
in the right location.

It appears that Perl 5.10.1 was installed and all the modules I installed are associated with Perl 5.10.1. When I try to run the get_iplayer PVR module I get the following error: Can't locate loadable object for module HTML::Parser in @INC (@INC contains: /opt/local/lib/perl5/5.8.8/darwin-2level
(I have abbreviated the error message)

And when I enter perl -v  I get the following:
This is perl, v5.8.8 built for darwin-2level

So the system does not see the Perl 5.10.1 install. Can someone please tell me if there is a was to install the modules so they relate to perl, v5.8.8, or point get_iplayer to use Perl 5.10.1.

I suspect that Apple's perl is 5.8.8 and it is installed in /usr/ bin. It needs to stay there because Apple's updates may depend on it. Installing 5.10.1 in /usr/bin/ replacing 5.8.8 is not recommended.

I also suspect that perl 5.10 is installed in /usr/local/bin but that might be different like /opt/bin depending on just how you installed it.. Look around for it. /opt/local/lib/ sounds unlikely to me.

You are probably going to make a change to your PATH environment variable to make the directory that perl 5,10 resides in appear before /usr/bin.

A shell command like:
setenv PATH /usr/local/bin:$PATH  # csh

PATH=/usr/local/bin:$PATH   # something like this in bash
export PATH

You can also specify PATH in a startup file
but you'll have to create that including the .MacOSX directory unless it's already there. There are some instructions on Apple's web site. Ask if you'd like a sample.

@INC is a perl array that lists directories in which modules can be found. There are a bunch of standard locations relative to the directory that perl itself lives in but you can add more directories by setting the PERL5LIB environment variable to a PATH- like list of other directories. That too can be done in environment.plist.

It's a bit hard to understand why iplayer doesn't have an installation script or at least some less geeky instructions for users.

I am puzzled why the original poster is having problems with 'get_iplayer'. Out of curiosity I downloaded it and find it runs fine here on a standard Apple Perl install. Regrettably I have deleted the original post but I recollect the writer said he was not a frequent user of Perl? So I wondered if the following thoughts might be helpful.

'get_iplayer.pl' is just a 272KB script (272KB) which can be put anywhere convenient and there is excellent documentation for it on the download site. Just for starters it is convenient to park it on the desktop.

The first thing to do is set the executable flag by the following line in Terminal.app
        chmod +x <full_path_to_'get_iplayer'>
-- it being understood that the easiest way to get the <full_path_to_'get_iplayer'> is just to drag 'get-iplayer.pl> from where it is on the Desktop into the Terminal window.

The next thing is simply to put
as the command line in Terminal (on line of course) and it should then list all available BBC TV files in alphabetical order. If it does not, then some investigation is called for.

To do this it makes life very much easier if the hidden folders (containing Perl and its modules) are made visible. To this execute the following in Terminal:
        /Developer/Tools/SetFile -a v 'full-path-name'
and then:
        killall "Finder"
For 'full path name put successively, /bin, /Library, /sbin, / System and /usr. (The process can be reversed by running the line again with the lower-case 'v' replaced by an upper-case 'V'.)

Now 'get_iplayer.pl' starts with the 'shebang' "#!/usr/bin/perl". So go to '/usr/bin' (now visible) and look for 'perl' -- it will surely be there.

The script 'uses' the following:

use Env q...@path];
use Fcntl;
use File::Copy;
use File::Path;
use File::stat;
use Getopt::Long;
use HTML::Entities;
use HTTP::Cookies;
use HTTP::Headers;
use IO::Seekable;
use IO::Socket;
use LWP::ConnCache;
use LWP::UserAgent;
use POSIX qw(mkfifo);
use Time::Local;
use URI;
use POSIX qw(:termios_h);

So, go to /System/Library/Perl/5.8.8 and look down the list to see that all these things are present. I would be astonished if any are missing in an Apple standard Perl install, but in that unlikely event, I would think the simplest thing would be to download the missing module from CPAN and pop it in. (On Mac OS X 10.4.* it might be 5.8.4 (?) I think, but that shouldn't matter at all -- the script should be quite happy with that version).

The next thing to check is that /System/Library/Perl is listed in @INC. Run the following in Terminal:
        perl -e 'foreach (@INC) {print"$_\n"}'
In the unlikely event it is not in the list, then add it to @INC.

I hope these notes might be helpful to someone relatively unused to Perl and apologise if I appear, so to speak, to be trying to teach my grandmother to suck eggs...

Alan Fry

(PS I am afraid I shall be away for ten days from tomorrow and unable to respond until I get back.)

Reply via email to