Hello all!
I have a new laptop. Apparently my Perl-Installation has problems. I
tried to update all outdated modules with cpanplus; but I get on many,
not all, modules error-messages, like:
Unable to create a new distribution object for 'HTML::Entities'
or
format not a string literal and no format arguments
With IO::Pty I got this message:
(see conf/compilerok.log). Suggestions:
1) The complier 'gcc-4.2' is not in your PATH. Add it
to the PATH and try again. OR
2) The compiler isn't installed on your system. Install it. OR
3) You only have a different compiler installed (e.g. 'gcc').
Either fix the compiler config in the perl Config.pm
or install a perl that was built with the right compiler
(you could build perl yourself with the available compiler).
making
% which gcc
I get:
/usr/bin/gcc
making
% gcc -v
I get:
Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc/gcc-5666.3~123/src/configure
--disable-checking --enable-werror --prefix=/usr --mandir=/share/man
--enable-languages=c,objc,c++,obj-c++
--program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib
--build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10-
--host=x86_64-apple-darwin10 --target=i686-apple-darwin10
--with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)
in /usr/bin my gcc is properly linked to gcc@ -> gcc-4.2
So, gcc seems to be al right. Is it possible, that the migration
assistant has mixed up, 32bit compiled modules with 64bit? Or is there a
confusion with the Perl of Fink? Here my Perl:
% perl -V
Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
Platform:
osname=darwin, osvers=10.0, archname=darwin-thread-multi-2level
uname='darwin pizzly.apple.com 10.0 darwin kernel version 10.0.0:
fri jul 31 22:46:25 pdt 2009; root:xnu-1456.1.25~1release_x86_64 x86_64 '
config_args='-ds -e -Dprefix=/usr -Dccflags=-g -pipe -Dldflags=
-Dman3ext=3pm -Duseithreads -Duseshrplib -Dinc_version_list=none
-Dcc=gcc-4.2'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc-4.2', ccflags ='-arch x86_64 -arch i386 -arch ppc -g -pipe
-fno-common -DPERL_DARWIN -fno-strict-aliasing -I/usr/local/include',
optimize='-Os',
cppflags='-g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing
-I/usr/local/include'
ccversion='', gccversion='4.2.1 (Apple Inc. build 5646)',
gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='gcc-4.2 -mmacosx-version-min=10.6.3', ldflags ='-arch x86_64
-arch i386 -arch ppc -L/usr/local/lib'
libpth=/usr/local/lib /usr/lib
libs=-ldbm -ldl -lm -lutil -lc
perllibs=-ldl -lm -lutil -lc
libc=/usr/lib/libc.dylib, so=dylib, useshrplib=true,
libperl=libperl.dylib
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags='-arch x86_64 -arch i386 -arch ppc
-bundle -undefined dynamic_lookup -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV
PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_ITHREADS
USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API
Locally applied patches:
/Library/Perl/Updates/<version> comes before system perl directories
installprivlib and installarchlib points to the Updates directory
Built under darwin
Compiled at Jan 26 2010 17:48:54
%ENV:
PERL5LIB="/sw/lib/perl5:/sw/lib/perl5/darwin"
@INC:
/sw/lib/perl5/5.10.0/darwin-thread-multi-2level
/sw/lib/perl5/5.10.0
/sw/lib/perl5/darwin-thread-multi-2level
/sw/lib/perl5
/sw/lib/perl5/darwin
/Library/Perl/Updates/5.10.0/darwin-thread-multi-2level
/Library/Perl/Updates/5.10.0
/System/Library/Perl/5.10.0/darwin-thread-multi-2level
/System/Library/Perl/5.10.0
/Library/Perl/5.10.0/darwin-thread-multi-2level
/Library/Perl/5.10.0
/Network/Library/Perl/5.10.0/darwin-thread-multi-2level
/Network/Library/Perl/5.10.0
/Network/Library/Perl
/System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level
/System/Library/Perl/Extras/5.10.0
Thank you for your help!
marek
Congrats! I have a new iMac, so I know the feeling. :-)
> 1) The complier 'gcc-4.2' is not in your PATH. Add it
> to the PATH and try again. OR
> 2) The compiler isn't installed on your system.
Did you reinstall Xcode, or did you migrate it from your old machine?
If you migrated, you might want to try installing a fresh copy of
Xcode.
sherm--
--
Cocoa programming in Perl:
http://camelbones.sourceforge.net
>...So, gcc seems to be al right. Is it possible, that the migration
>assistant has mixed up, 32bit compiled modules with 64bit? Or is
>there a confusion with the Perl of Fink? Here my Perl:
>
> Built under darwin
> Compiled at Jan 26 2010 17:48:54
> %ENV:
> PERL5LIB="/sw/lib/perl5:/sw/lib/perl5/darwin"
> @INC:
> /sw/lib/perl5/5.10.0/darwin-thread-multi-2level
> /sw/lib/perl5/5.10.0 ...
I think you're going to have trouble until you get rid of everything
Fink has installed and everything it's changed in /usr/bin.
If I were you I'd probably delete /usr/bin/perl and replace it with a
link but I'd wait for others to give you more experienced advice.
I would also install the latest Xcode.
Note that gcc -v will give you gcc-4.0 and not gcc-4.2 unless you
have replaced Apple's original link, so maybe Fink did that too.
JD
Thank you John, Thank you Sherm!
I did install the new XCode.
<offtopic>My new laptop was a not really cheap: 2600 Euros, and Apple is
asking for the XCode download 3.90 Euros. This is nit-picking in my
eyes. I don't know, where Apple is going, but I see in the last years
only toys and no real support of professionals.</offtopic>
gcc-4.2 was installed with the latest XCode 4.0.2 Is Fink installing
into /usr/bin ? Or is it a misunderstanding?
Probably there are old and new mixed up from migrating from my back-up.
marek
Not here in Germany :-( In old times there was XCode on the optional
installer DVD. Now there are only toys: iDVD, Sound & Jingles, iPhoto
... That's all, what Apple offers as extra for a 2600 Euro computer ...
marek
Fink neither changes nor installs anything in /usr/anything. It's all under /sw.
>gcc-4.2 was installed with the latest XCode 4.0.2 Is Fink installing
>into /usr/bin ? Or is it a misunderstanding?
I have both gcc-4.0 and gcc-4.2 in /usr/bin but gcc points to
gcc-4.0. I have Xcode version 3.2.6 and I see in Get Info that there
is an option to open in 32-bit mode. That may have been switched on
in the migration... but listen to wiser counsel than mine.
><offtopic>My new laptop was a not really cheap: 2600 Euros, and
>Apple is asking for the XCode download 3.90 Euros. This is
>nit-picking in my eyes. I don't know, where Apple is going, but I
>see in the last years only toys and no real support of professionals.
I have been thinking so all day after watching the announcement of
iCloud, a complete non-happening designed, like everything Apple, for
shop-happy groupees. It is "free", up to a point, once you have
bought your latest Mac, your latest iPhone and your latest iPad, paid
the interest on the loans and the subscription to all the service
providers for the connectivity needed to download tune after useless
tune at an inflated price. My first 128K Mac with a dot matrix
printer cost me over $4,000 in 1984, so the writing has been on the
wall for a long time. </offtopic>
JD
I use MacPort and I ended up deleting everything from MacPort before
re-installing everything.
As for deleting Perl from /usr/bin that is a VERY BAD IDEA. That came as
part of the Apple OS so it's used by Apple for software install and
upgrades. Never ever delete anything installed by Apple.
Mel
On Wed, Jun 8, 2011 at 9:31 AM, John Delacour <J...@bd8.com> wrote:
> At 16:02 +0200 08/06/2011, Marek Stepanek wrote:
>
>
> ...So, gcc seems to be al right. Is it possible, that the migration
>> assistant has mixed up, 32bit compiled modules with 64bit? Or is there a
>> confusion with the Perl of Fink? Here my Perl:
>>
>>
>> Built under darwin
>> Compiled at Jan 26 2010 17:48:54
>> %ENV:
>> PERL5LIB="/sw/lib/perl5:/sw/**lib/perl5/darwin"
>> @INC:
>> /sw/lib/perl5/5.10.0/darwin-**thread-multi-2level
>> /sw/lib/perl5/5.10.0 ...
>>
>
> I think you're going to have trouble until you get rid of everything Fink
> has installed and everything it's changed in /usr/bin.
>
Mel
On Wed, Jun 8, 2011 at 9:55 AM, Marek Stepanek <mareks...@yahoo.co.uk>wrote:
> On 08.06.2011 17:31, John Delacour wrote:
>
>> At 16:02 +0200 08/06/2011, Marek Stepanek wrote:
>>
>>
>> ...So, gcc seems to be al right. Is it possible, that the migration
>>> assistant has mixed up, 32bit compiled modules with 64bit? Or is there
>>> a confusion with the Perl of Fink? Here my Perl:
>>>
>>> Built under darwin
>>> Compiled at Jan 26 2010 17:48:54
>>> %ENV:
>>> PERL5LIB="/sw/lib/perl5:/sw/**lib/perl5/darwin"
>>> @INC:
>>> /sw/lib/perl5/5.10.0/darwin-**thread-multi-2level
>On 08.06.2011 18:03, Melton Low wrote:
>>xCode 4 should have been included with your new Mac. Check in the
>>Optional Application install disc.
XCode 4 is only for bleeding-edge developers.
>Not here in Germany :-( In old times there was XCode on the optional
>installer DVD. Now there are only toys: iDVD, Sound & Jingles,
>iPhoto ... That's all, what Apple offers as extra for a 2600 Euro
>computer ...
XCode 3.2.6 should be on the disks and is all you need. On the main
install disk I got with the Mac Mini in January there is a folder
"Optional Installs" with the XCode package in it. I have a feeling
Sofware Update has updated it since I first installed it.
If it's not on the disk you can get it free from
<http://developer.apple.com/devcenter/mac/index.action> provided you
are a member -- and this grade of membership is free.
Good luck.
JD
xcode4 is only available if you are a $99/yr developer.
>xcode4 is only available if you are a $99/yr developer.
If you read what I wrote you will see I was not talking about XCode 4.
Besides, as Marek said in the beginning, you can get it for $4.99 at
the app store -
<http://itunes.apple.com/us/app/xcode/id422352214?mt=12&ls=1>
JD
A pointless exercise - Like Fink, MacPorts doesn't touch /usr.
Everything relevant to MacPorts is found under /opt/local.
Any chance we might keep this on-topic for once? I don't see how *any*
of this whine-fest is relevant to the issue at hand.
>On Wed, Jun 8, 2011 at 11:49 AM, Melton Low <softw...@gmail.com> wrote:
>>
>> I use MacPort and I ended up deleting everything from MacPort before
>> re-installing everything.
>
>A pointless exercise - Like Fink, MacPorts doesn't touch /usr.
>Everything relevant to MacPorts is found under /opt/local.
Please explain then how Marek gets
/sw/lib/perl5/5.10.0 ...
when he does perl -V from the command line.
Are you saying that a script on his machine with the shebang
#!/usr/bin/perl will completely ignore /sw/...?
If I do perl -V I get the Apple installation
If I do /usr/local/bin/./perl -V then I get
/usr/local/lib/perl5/site_perl/5.14.0...
JD
PS. I don't need two copies of every posting to the list.
No. I'm saying that there are *many* ways to influence @INC without
bothering any files under /usr.
PERL5LIB, for one.
> PS. I don't need two copies of every posting to the list.
Complain to the list admins. They're the ones who broke "reply all," not me.
>No. I'm saying that there are *many* ways to influence @INC without
>bothering any files under /usr.
>
>PERL5LIB, for one.
I'm sure that's very clear to everyone who already knows what you are
talking about. Are you saying that by editing ~/.bashrc or some such
file one could remove this environment variable that has been added
by some fink or port or other animal? If that's what you mean, why
not say so. I thought people asked questions on this list in order
to get useful answers rather than merely to be informed that someone
has the answer but hasn't the time to give it.
>> PS. I don't need two copies of every posting to the list.
>
>Complain to the list admins. They're the ones who broke "reply all," not me.
You alone are responsible for who you send emails to. Are you
getting a duplicate of this?
JD
Because there's nothing at all Mac-specific about it, and it's
well-covered in the Perl man pages and many many tutorials, as well as
having been discussed right here already, *many* times. If you can't
be bothered to do even the most basic research, that's neither my
fault nor my problem. I gave you the clue you needed, now go to Google
and use it.
>> Complain to the list admins. They're the ones who broke "reply all," not
>> me.
>
> You alone are responsible for who you send emails to.
Blaming other people for your ignorance is a habit with you, isn't it?
Yes, I'm responsible for who *I* send emails to. I'm not responsible
for who the list sends emails to. A correctly-configured list will
look at the To: and CC: headers of any mail it receives, and won't
send an additional copy to anyone who's already received one.
Ouch! At the current rate, that translates to roughly $3800 USD -
$1400 more than the highest-price MacBook Pro in the US store. I
wonder, how much of that was import taxes & tariffs?
> Probably there are old and new mixed up from migrating from my back-up.
I'm probably over-cautious, but I never migrate - I always format and
make a clean install, then do a clean install of all my apps. I back
up my home directory, and copy it over, which preserves all my
personal preferences and such.
>
> I'm probably over-cautious, but I never migrate - I always format and
> make a clean install, then do a clean install of all my apps. I back
> up my home directory, and copy it over, which preserves all my
> personal preferences and such.
>
> sherm--
>
Sherm, I would like to keep now my installation, as it is. If possible.
Or I would compile perl-5.14.0 under /usr/local
But perhaps this list could help me, to get @INC and $PERL5LIB clean of
/sw ... How is it possible, that I have $PERL5LIB set to
%ENV:
PERL5LIB="/sw/lib/perl5:/sw/lib/perl5/darwin"
I only see two files:
~/.profile
and
~/.tcshrc
in the first file I only have one line:
test -r /sw/bin/init.sh && . /sw/bin/init.sh
in .tcshrc is longer:
***
setenv LC_ALL C
setenv LANG en_GB.UTF-8
# export LC_MESSAGES="C" How to set this var?
# export ARCHFLAGS="-arch i386 -arch x86_64"
set complete=enhance
set addsuffix
set autoexpand
set histdup=erase
set autolist
set autocorrect
set backslash_quote
set correct=cmd
set dspmbyte=utf8
unset histlit
set symlinks=ignore
unset recexact
bindkey -k up history-search-backward
bindkey -k down history-search-forward
alias ls ls -sGF
alias rm rm -i
alias srm srm -i
alias mv mv -i
alias twics "cd ~/Documents/tschessfeils_new/twics_new"
alias mysql /usr/local/mysql/bin/mysql
alias mysqladmin /usr/local/mysql/bin/mysqladmin
set path = (/usr/local/mysql/bin $path)
set path = (/usr/local/bin $path)
set path = (/sw/include $path)
set path = (/usr/local/sbin $path)
alias files ls -lF \*/..namedfork/data \*/..namedfork/rsrc
test -r /sw/bin/init.csh && source /sw/bin/init.csh
***
To export the right PERL5LIB, can I add the following line to ~/.tcshrc
set PERL5LIB = (/System/Library/Perl/5.10.0:/Library/Perl/5.10.0)
?
Syntax seems alright, but I have still the /sw path at the beginning:
%ENV:
PERL5LIB="/sw/lib/perl5:/sw/lib/perl5/darwin:/System/Library/Perl/5.10.0:/Library/Perl/5.10.0"
And in @INC too:
@INC:
/sw/lib/perl5/5.10.0/darwin-thread-multi-2level
/sw/lib/perl5/5.10.0
/sw/lib/perl5/darwin-thread-multi-2level
/sw/lib/perl5
/sw/lib/perl5/darwin
/System/Library/Perl/5.10.0/darwin-thread-multi-2level
/System/Library/Perl/5.10.0
/Library/Perl/5.10.0/darwin-thread-multi-2level
/Library/Perl/5.10.0
/Library/Perl/Updates/5.10.0/darwin-thread-multi-2level
/Library/Perl/Updates/5.10.0
/System/Library/Perl/5.10.0/darwin-thread-multi-2level
/System/Library/Perl/5.10.0
/Library/Perl/5.10.0/darwin-thread-multi-2level
/Library/Perl/5.10.0
/Network/Library/Perl/5.10.0/darwin-thread-multi-2level
/Network/Library/Perl/5.10.0
/Network/Library/Perl
/System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level
/System/Library/Perl/Extras/5.10.0
Sorry for this long email.
marek
PERL5LIB can be set in either one; which one is executed depends on
what shell you're using. The current default shell is Bash, which
reads .profile - at one point in ancient history, the default was
Tcsh, which reads .tcshrc.
> in the first file I only have one line:
>
> test -r /sw/bin/init.sh && . /sw/bin/init.sh
If you haven't changed your default shell, that's the culprit. It
executes Fink's init.sh script, which exports the PERL5LIB environment
variable. Again, this behavior goes back a while - they used to think
it was a good idea for the system Perl to be able to see modules that
Fink had installed under /sw/lib.
I haven't used Fink in a while - I switched to MacPorts - but I
*thought* they stopped doing that after a few Mac OS X releases, each
with a new version of Perl that disagreed with those modules, showed
them how problematic that was. If you've been migrating for a while,
that line in .profile could be a remnant from an old install.
At any rate, delete (# or comment) that line, exit from the shell
session and start a new one, and that should clear up your PERL5LIB
variable.
> To export the right PERL5LIB, can I add the following line to ~/.tcshrc
>
> set PERL5LIB = (/System/Library/Perl/5.10.0:/Library/Perl/5.10.0)
That wouldn't accomplish anything - PERL5LIB just adds to the default
paths, and the above are already in the default.
> Syntax seems alright, but I have still the /sw path at the beginning:
Did you log out of the current shell session, and back in? These
startup files are only processed when you start a new shell session,
not every time they're changed.
> Blaming other people for your ignorance is a habit with you, isn't it?
> Yes, I'm responsible for who *I* send emails to. I'm not responsible
> for who the list sends emails to. A correctly-configured list will
> look at the To: and CC: headers of any mail it receives, and won't
> send an additional copy to anyone who's already received one.
--As for the rest, it is mine.
I'd argue that's a broken list, as it doesn't send me mail with the list
headers.
There are major arguments over the technically correct solution. Let's not
get into them here. Suffice it to say, if someone asks you to not CC them
when you send to the list, it's polite not to. (At least for that
discussion.)
Daniel T. Staal
---------------------------------------------------------------
This email copyright the author. Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes. This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------
In general, I'd agree - but I also think it's appropriate to consider
the tone & reason for the request. By the time John got around to
that, I had already debunked his theory about Fink, and asked him to
stop the off-topic digressions about "overpriced" Mac hardware. I
suspect he was just upset about that, and looking for any excuse to
complain about something.
This is a step in the right direction. But my cpanplus Perl is still
broken, with messages like:
Unable to create a new distribution object for 'Archive::Tar', although
I have no /sw in the %ENV or @INC any more.
% perl -V
even does not show a %ENV at all. This is certainly not right, isn't it?
In the @INC is now:
@INC:
/Library/Perl/Updates/5.10.0/darwin-thread-multi-2level
/Library/Perl/Updates/5.10.0
/System/Library/Perl/5.10.0/darwin-thread-multi-2level
/System/Library/Perl/5.10.0
/Library/Perl/5.10.0/darwin-thread-multi-2level
/Library/Perl/5.10.0
/Network/Library/Perl/5.10.0/darwin-thread-multi-2level
/Network/Library/Perl/5.10.0
/Network/Library/Perl
/System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level
/System/Library/Perl/Extras/5.10.0
the .profile is not changing anything, whether I remove it or not. And
the X11 terminal is not working any more, not finding the path. If I put
back the line
test -r /sw/bin/init.csh && source /sw/bin/init.csh
into my ~/.tchrc the X11-terminal (Fink) is working again. But I have
back in my % perl -V
%ENV:
PERL5LIB="/sw/lib/perl5:/sw/lib/perl5/darwin:/System/Library/Perl/5.10.0:/Library/Perl/5.10.0"
Probably I will leave the apple Perl it as it is, and make a new install
of perl-5.14.0 under /usr/local
Thank you again
marek
Now I see no PERL5LIB in %ENV. I guess Perl is looking in
/System/Library/Perl/5.10.0
/Library/Perl/5.10.0
/System/Library/Perl/Extras/5.10.0
but I really don't know.
Regards,
Vic
>Probably I will leave the apple Perl it as it is, and make a new
>install of perl-5.14.0 under /usr/local
That is what I do, so that the two installations are independent. I
configure simply like this:
cd downloaded_directory
./Configure -de -Dperladmin=em...@addr.com -Dcf_email=em...@addr.com
make
make test
sudo make install
Others may have more elaborate configuration suggestions but this
works fine for me.
If I want to use the latest perl I change the shebang accordingly.
One thing to remember, of course, is that to add modules with cpan to
5.14.0 so configured, rather than to Apple's installation, you need to
cd /usr/local/bin; sudo ./cpan
JD
On 9/06/11 at 4:40 PM +0100, John Delacour <J...@BD8.com> wrote:
>One thing to remember, of course, is that to add modules with
>cpan to 5.14.0 so configured, rather than to Apple's
>installation, you need to
>
>cd /usr/local/bin; sudo ./cpan
I haven't followed all of this thread (it was digressing there
for a while). Would perlbrew be a solution for the OP. I've only
been using it a short while but it makes installing and using a
custom perl very simple.
<http://search.cpan.org/perldoc?perlbrew>
Eg:
$ perlbrew install perl-5.14.0
$ perlbrew switch perl-5.14.0
$ cpan ....
Works a treat for me.
Charlie
--
Ꮚ Charlie Garrison ♊ <garr...@zeta.org.au>
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
〠 http://www.ietf.org/rfc/rfc1855.txt
I've been meaning to check that out. It must do more than what I think
it does, because installing a new Perl is already pretty simple:
./Configure -des --prefix=/where/ever
make
make test
sudo make install
I'll have to read up on it (thanks for the link) to see what else it does...
To be honest, I wouldn't have expected removing the /sw directories
from @INC to fix anything. That's why I told John that worrying about
Fink was pointless - there was nothing in your original report that
suggested it might have been the source of the problem.
Have you checked permissions on ~/.cpan? The error message sounds like
it can't download and/or unpack the Archive::Tar package. If you're
not running the CPAN shell as root (and you shouldn't be!), try making
sure that the .cpan directory and everything under it is owned and
writable by your user:
cd ~
sudo chown -R your_username .cpan
chmod -R g+w .cpan
You need "sudo" for the chown because, if anything is owned by someone
else, you'll need root authority to change its ownership.
> even does not show a %ENV at all. This is certainly not right, isn't it?
That doesn't mean you have no environment variables at all, just none
that Perl cares about. (If you recall, it was only showing PERL5LIB
before, even though you probably had a lot more than that.)
Fear is the mind-killer. :-)
Understanding what Fink does, and does NOT do, is key here. It doesn't
damage or modify your system Perl in any way. All it does is add a
single environment variable that Perl (any Perl, not just Apple's)
looks for when it starts up.
If you want the rest of Fink, but don't want its changes to PERL5LIB,
just undo them. Leave the call to its init.sh in your .profile, and
immediately after that, add a line that overrides its changes to
PERL5LIB:
export PERL5LIB=''
I installed the preconfigured version from active state recently and was pleasantly surprised at how it took care of pretty much everything. That might be another option for the original poster.
Wayne
The main feature is that it downloads and installs whatever version
you ask it to install. The second feature is that it manages more
than one copy of perl for you. So, say you have a work version of
perl that is at 5.8.8 and a home version that is at 5.14.0. You can
say
perlbrew install perl-5.8.8
perlbrew install perl-5.14.0
perlbrew switch perl-5.14.0
At this point the version of perl found in the PATH will be 5.14.0
perlbrew switch perl-5.8.8
Now, the version of perl found in the PATH will be 5.8.8
Let's go further and say your work has a web code and backend code.
Different modules are installed in each environment. You can say
perlbrew install perl-5.8.8 --as web
perlbrew install perl-5.8.8 --as backend
You can then switch between them like this
perlbrew switch web
perlbrew switch backend
Any modules you install with cpan, cpanp, or cpanm (hint: use
"perlbrew install-cpanm" to get cpanm easily and globally for all of
the managed perls) will only get installed in the current version.
If patchperl is installed (and it gets installed by the install script
from the POD), it will allow you to build older versions of perl that
break on newer machines.
That is about all it does, but that can be incredibly useful.
--
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.
> But perhaps this list could help me, to get @INC and $PERL5LIB clean of
> /sw ... How is it possible, that I have $PERL5LIB set to
>
> %ENV:
> PERL5LIB="/sw/lib/perl5:/sw/lib/perl5/darwin"
>
> in [my .profile] I only have one line:
>
> test -r /sw/bin/init.sh && . /sw/bin/init.sh
So you're wondering where the /sw/wibble is coming from, and you've
found something mentioning /sw/wibble in your .profile. D'you think
they might be related?
Several fixes come to mind:
1. delete that line from .profile. This will, however, prevent anything
else that it does from happening.
2. edit /sw/bin/init.sh to prevent it from messing with PERL5LIB.
3. save PERL5LIB before that line and restore it afterwards.
4. just set PERl5LIB to whatever you fancy after that line. This will,
however, mean that you override any changes that may be made to your
startup files elsewhere at a later date.
--
David Cantrell | Reality Engineer, Ministry of Information
Blessed are the pessimists, for they test their backups
That plist is for setting up environment variables for GUI apps. It
has no effect on shell sessions.
>Several fixes come to mind:
>...
>4. just set PERl5LIB to whatever you fancy after that line. This will,
> however, mean that you override any changes that may be made to your
> startup files elsewhere at a later date.
What would be the effect of setting a value (or no value) for
PERL5LIB in ~/.MacOSX/environment.plist? Would that override
anything written to .profile etc.?
JD
> > What would be the effect of setting a value (or no value) for PERL5LIB in
>> ~/.MacOSX/environment.plist?
>
>That plist is for setting up environment variables for GUI apps. It
>has no effect on shell sessions.
Obviously I'm missing something. If I do set it, it seems to have
the same effect superficially as fink's exporting it via
.profile/init.sh, which I thought was the problem:
perl -V
Compiled at Jan 26 2010 17:48:53
%ENV:
PERL5LIB="/usr/local/lib/perl5/site_perl/5.14.0"
@INC:
/usr/local/lib/perl5/site_perl/5.14.0
/Library/Perl/Updates/5.10.0/darwin-thread-multi-2level
perl -e 'print $ENV{PERL5LIB}'
/usr/local/lib/perl5/site_perl/5.14.0
JD
That's not the case for 10.3.9. Has it changed?
I have been defining $PERL5LIB and some other stuff in environment.plist for years mostly because of AppleScripts I like to use. Most of the scripts are executed with osascript from a shell and they work fine with no additional redefinition in .tcshrc.
They also work OK when I log in to 10.3.9 from a Linux box or use bbedit worksheets.
I always thought environment.plist was just a way to be sure things were set immediately after the sort of login that is used to start up the machine rather than waiting for a shell style login.
--
--> A fair tax is one that you pay but I don't <--
Yes, but since .profile is evaluated later, whatever it does will
override what's set in the plist. Thus, changes in the plist will have
no effect on shell sessions that set the same variable.
Nor, as far as I can tell, will anything the OP does with respect to
his @INC. My best guess about that his "unable to create a
distribution object" relates to many of the files under ~/.cpan being
owned by root. This whole Fink/@INC/PERL5LIB subthread is little more
than a pointless distraction that won't solve the OP's actual problem.
Are you using Terminal.app? That's a GUI application, so it takes
effect, and is then inherited by the shell. Try sshing into your
Mac from elsewhere.
--
David Cantrell | Enforcer, South London Linguistic Massive
PERL: Politely Expressed Racoon Love
>Are you using Terminal.app? That's a GUI application, so it takes
>effect, and is then inherited by the shell. Try sshing into your
>Mac from elsewhere.
Right. I ran a script from cgi-bin on my local server and indeed
this key was missing. The same script run in BBEdit had it. All
clear. Thanks.
JD
I use this line in my .bash_profile to make sure I use the
same PATH everywhere (and only have to edit it in one place):
export PATH=`/usr/libexec/PlistBuddy -c 'Print :PATH' ~/.MacOSX/environment.plist`
The same can be done for PERL5LIB.
Cheers,
-Jan
It can be - and I've copied that into my Collection of Handy Stuff. :-)
But the question is, should it be done for PERL5LIB? That affects
*all* Perls, and if you've included the path to modules compiled for
(say) 5.12, but you're running 5.10, those modules won't work.
That's exactly the problem that bit Fink some time ago - their init.sh
used PERL5LIB to add their Perl module directories, which had modules
they'd compiled with 5.6 - when Apple then released a version of Mac
OS X that used Perl 5.8.1, those Fink-provided modules no longer
worked. There was much wailing and gnashing of teeth over Fink
"breaking Apple's Perl," but in fact they didn't do that; they hadn't
touched Apple's Perl at all, they had simply told *all* Perls to look
for modules that only some Perls would be able to use.
Ah, yes, sorry, lost track of the real topic of the thread.
I think a better way to modify your @INC is on a per-installation
basis. For Apple's Perl you have the AppendToPath and PrependToPath
mechanism, e.g.
$ cat /Library/Perl/5.10.0/AppendToPath
/System/Library/Perl/Extras/5.10.0
There is no PrependToPath file by default, but you can create one
yourself, and all directories listed in there will be put at the
front of @INC, just as if you put them into PERL5LIB.
If you build your own Perl, then you may want to ./Configure it
with -Dusesitecustomize. That way you can modify @INC in a
perl/site/lib/sitecustomize.pl file at runtime.
ActivePerl uses this mechanism to add a per-user install directory
to @INC:
$ cat /usr/local/ActivePerl-5.14/site/lib/sitecustomize.pl
# ~/Library/ActivePerl-5.14 is the default location for PPM install
# So make sure we look for modules there
if (my $home = (getpwuid($<))[7]) {
my $lib = "$home/Library/ActivePerl-5.14/lib";
unless (grep { $_ eq $lib } @INC) {
# Insert $lib just ahead of 'site/lib' so that overrides
# via $ENV{PERL5LIB} or 'perl -I...' still works
(my $site = __FILE__) =~ s,/sitecustomize\.pl\z,,;
my $i = $#INC;
$i-- while $i > 0 && $INC[$i] ne $site;
splice(@INC, $i, 0, $lib);
}
}
This sitecustomize.pl script is a little more complicated because
it inserts the directory behind the ones specified with PERL5LIB
and -I, but before the builtin ones:
$ PERL5LIB=~/mylib perl -E 'say for @INC'
/Users/jan/mylib
/Users/jan/Library/ActivePerl-5.14/lib
/usr/local/ActivePerl-5.14/site/lib
/usr/local/ActivePerl-5.14/lib
.
So again, you can customize your @INC setup for each Perl installation
independently without resorting to global environment variables, which
will just get in the way at the wrong time...
Cheers,
-Jan
>I think a better way to modify your @INC is on a per-installation
>basis. For Apple's Perl you have the AppendToPath and PrependToPath
>mechanism...
>There is no PrependToPath file by default, but you can create one
>yourself, and all directories listed in there will be put at the
>front of @INC, just as if you put them into PERL5LIB.
>
>If you build your own Perl, then you may want to ./Configure it
>with -Dusesitecustomize. That way you can modify @INC in a
>perl/site/lib/sitecustomize.pl file at runtime.
Very useful information, Jan. Many thanks.
JD