Re: Help setting Perl path

2009-09-21 Thread Doug McNutt
I'm adding some comments between yours. To me the state of affairs reminds me 
of the terrible problems I got into when first moving from MacPerl on OS 9 to 
real perl on OS 10. With Fink, DarwinPorts, and CPAN I got really lost. 
Darwin is now MacPorts and CPAN has been improved but I'm stuck on OS 10.3.9 
because I insist on using my SE/30 file server from long ago.  Ubuntu is fun.

What I have been personally doing is just not using stuff directly from any of 
those we'll do it for you schemes that seem always to have an entirely 
different idea about how I want to organize my life with my computer. I use 
those sites as sources of code but I pretty much always recompile the stuff 
here or, in the case of perl modules that don't use any included C code, it's 
just a copy  of the source. I put things in my home directory under $HOME/perl/ 
and point to that with $PERL5LIB. It's often a pain because of dependencies 
that you don't discover right away but I prefer that to not having the foggiest 
idea where things were put.

You are less familiar with command line UNIX than I am and I am still having 
problems because of my prior experience on a 64 kiloword UNIX box in the late 
1970's gets in the way of more modern tools. I'm also a csh user who has never 
figured out sh and bash.

Others on this list are more knowledgeable than I. I hope some of them will 
have suggestions based on comments here and below.

At 22:23 +0100 9/17/09, Mine wrote:
You are right the first line of get_iplayer is #!/usr/bin/perl

That's pretty much standard these days. It's there so the UNIX kernel knows 
what software - perl - to use when executing a file by typing its name at the 
start of a command line.

Up to line 25 appear like comments about the program.
Line 26 is:  package main;
Line 50:  use Env q...@path];

Normally the environment variable PATH would be accessed by $p = $ENV{'PATH'}; 
followed by a split command to change the string to a list of individual 
directories. This author uses the Env module probably because perl works in 
non-UNIX environments and the module makes the code portable.

Line 51 down to 69 is the Perl modules to use
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::Debug qw(+);
use LWP::UserAgent;
use POSIX qw(mkfifo);
use strict;
#use warnings;
use Time::Local;
use URI;
use POSIX qw(:termios_h);

Those seem reasonable. Note that the # lines are commented out. They were 
likely used during debugging by the author.

When I use either of the following:
 /usr/local/bin/perl   -w   get_iplayer
 /usr/local/bin/perl5.10.1   -w   get_iplayer

With all of the copies of perl you seem to have the execute line with the 
complete path to perl5.10.1 is probably what you  should be sticking with.. 
With it you will be ignoring the #! line in the code for  get_iplayer. You 
might also want to prepare a complete path for get_iplayer and put it into the 
command. Your shell will allow you to make an alias of the line so it's easy to 

I get this in the Terminal:
Can't locate loadable object for module HTML::Parser in @INC
   (@INC  contains:
   /usr/local/lib/ perl5/5.10.1
   /usr/local/lib/perl5/site_perl/5.10.1 .)
at /usr/local/lib/perl5/5.10.1/ HTML/ line 145

Compilation failed in require at /usr/local/lib/perl5/5.10.1/HTML/ 
line 145.
Compilation failed in require at get_iplayer line 56.
I assumed that some of the modules are missing so when I used  to try  and 
install then I get the following:
cpan install HTML::Entities
HTML::Entities is up to date.

What's happening is that HTML::Entities contains a use HTML::Parser probably 
at line 145. I would look up the code for HTML::Entities and have a look. With 
luck the module will be pure perl with no C-language parts. In any case what 
you would need to install is HTML::Parser - and anything it uses.  The problem 
is recursive dependencies which CPAN, and the other port services are supposed 
to be taking care of. My experience with that is terrible and, by the way, it's 
not so good in many UNIX distributions other than OS neXt either.

CPAN seems to think all the modules are up to date.

 Do a Finder get info on /usr/bin/perl and post what it says.

No sure what you need me to post. Kind: Unix Executable File, Size:  20 KB, 
Where: /usr/bin, Open with: not applicable.
Yeah. Finder doesn't speak perl or UNIX very well.

 ls -lF /usr/bin/perl*

-rwxr-xr-x   1 root  wheel  19280 Jan 30  2006 /usr/bin/perl*
-rwxr-xr-x   1 root  wheel  19280 Jan 30  2006 /usr/bin/perl5.8.6*

That pair is interesting. It would be common to have /usr/bin/perl be a hard 
link (man ln for more about that) to the version of perl that a user wants to 
use. It might be created this way

Help setting Perl path

2009-09-16 Thread Mine


I have Perl 5.8.8 installed by MacPorts and a CPAN install of 5.10.1.
Is there a simple way switch between them hopefully from the Terminal,
so I can use 5.10.1 when using get_iplayer and 5.8.8 for other programs.

In a previous post, it was suggested that I create an  
environment.plist. Using the following instructions:

mkdir $HOME/.MacOSX
cat  $HOME/.MacOSX/environment.plist
?xml version=1.0 encoding=UTF-8?
!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://

plist version=1.0


I assume this method is not temporary, but when I restarted my  
system, there was no change
to the version of Perl being used. And to be honest, I didn't really  
understand what I was

being told to do.

I know for many getting get_iplayer to work on there system has been  
relatively easy, but I just

can't get all the needed modules installed in my Perl 5.8.8.



Re: Help setting Perl path

2009-09-16 Thread Doug McNutt
At 22:10 +0100 9/16/09, Mine wrote:
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;


I have Perl 5.8.8 installed by MacPorts and a CPAN install of 5.10.1.
Is there a simple way switch between them hopefully from the Terminal,
so I can use 5.10.1 when using get_iplayer and 5.8.8 for other programs.

You must have links and aliases to perl that are making life difficult.

Copy the first 5 lines of the get_iplayer script and post them. I'm 
particularly interested in a line, probably the first, that is something like:


Copy and paste some of the Terminal lines you have used with the error messages 
included and post them too. Is it just


Or have you tried things like:
/usr/local/bin/perl   -w   get_iplayer
/usr/local/bin/perl5.10.1   -w   get_iplayer

Do a Finder get info on /usr/bin/perl and post what it says.

In terminal, do these:

ls -lF /usr/bin/perl*
  and post the answer.

file /usr/bin/perl
  and post the answer.

and . . .
seems to have acquired a space. in the middle of the line. That has to be an 
e-mail problem.  Sigh.

You can make a Finder alias or a UNIX link to the full path to the perl you 
want to use. Call it myperl and make it executable.  man ln in Terminal for 
more on that.

myperl get_iplayer

-- In Christianity, man can have only one wife. This is known as monotony. --