thorby has asked for the wisdom of the Perl Monks concerning the following question:

Update: I have found there are two Zlib.pm files at different levels in the @INC list. Am disabling the older to see what happens...

Further Update: renaming the older Zlib.pm eliminates the multiple messages about names being redefined. However it does not eliminate the recursive loop. It appears to happen now whenever cpan goes to fetch with LWP.

Now I've found yet a third Zlib.pm in the /System/Library/blahblah/IO directory. It appears to be older & simpler than the other two.

FINAL update: I Fixed This Sucker! (Raise my reputation, dudes...) Disabling (renaming) both Zlib.pm files leaving only IO/Zlib.pm eliminated the problem. Now I was able to execute the recommended cpan update (install Bundle::CPAN) and this operation replaced one of the Zlib.pm files with a yet newer one.

I speculate that when I used Apple's Migration Assistant to bring files from the old system, it somehow polluted the Macpro's library with old files. But I'll never know (or care, really).

Is there something (known to be) wrong with the Perl delivered as part of new intel macs? I'm setting up a new Macpro (yay!) but, trying to install Perl-based software I've used on prior systems, cpan breaks badly (oooh). Here is a typical result -- it seems clear that two modules (compress/Zlib and constant.pm) are fighting -- then there is a recursive loop that has to be cancelled by ^C (sometimes) or killing the perl process other times.

cpan> i * CPAN: Storable loaded ok Going to read /Users/dcortesi/.cpan/sources/authors/01mailrc.txt.gz gzip: /Users/dcortesi/.cpan/sources/authors/01mailrc.txt.gz: unexpecte +d end of file CPAN: LWP::UserAgent loaded ok Fetching with LWP: http://www.perl.com/CPAN/modules/02packages.details.txt.gz Subroutine AUTOLOAD redefined at /Library/Perl/5.8.6/darwin-thread-mul +ti-2level/Compress/Zlib.pm line 84. Subroutine isaFilehandle redefined at /Library/Perl/5.8.6/darwin-threa +d-multi-2level/Compress/Zlib.pm line 106. Subroutine isaFilename redefined at /Library/Perl/5.8.6/darwin-thread- +multi-2level/Compress/Zlib.pm line 115. Subroutine gzopen redefined at /Library/Perl/5.8.6/darwin-thread-multi +-2level/Compress/Zlib.pm line 122. Subroutine ParseParameters redefined at /Library/Perl/5.8.6/darwin-thr +ead-multi-2level/Compress/Zlib.pm line 139. Subroutine deflateInit redefined at /Library/Perl/5.8.6/darwin-thread- +multi-2level/Compress/Zlib.pm line 205. Subroutine inflateInit redefined at /Library/Perl/5.8.6/darwin-thread- +multi-2level/Compress/Zlib.pm line 217. Subroutine Compress::Zlib::deflateStream::deflateParams redefined at / +Library/Perl/5.8.6/darwin-thread-multi-2level/Compress/Zlib.pm line 2 +27. Subroutine compress redefined at /Library/Perl/5.8.6/darwin-thread-mul +ti-2level/Compress/Zlib.pm line 256. Subroutine uncompress redefined at /Library/Perl/5.8.6/darwin-thread-m +ulti-2level/Compress/Zlib.pm line 287. Constant subroutine Compress::Zlib::MAGIC1 redefined at /System/Librar +y/Perl/5.8.6/constant.pm line 108. Constant subroutine Compress::Zlib::MAGIC2 redefined at /System/Librar +y/Perl/5.8.6/constant.pm line 108. Constant subroutine Compress::Zlib::OSCODE redefined at /System/Librar +y/Perl/5.8.6/constant.pm line 108. Constant subroutine Compress::Zlib::FTEXT redefined at /System/Library +/Perl/5.8.6/constant.pm line 108. Constant subroutine Compress::Zlib::FHCRC redefined at /System/Library +/Perl/5.8.6/constant.pm line 108. Constant subroutine Compress::Zlib::FEXTRA redefined at /System/Librar +y/Perl/5.8.6/constant.pm line 108. Constant subroutine Compress::Zlib::FNAME redefined at /System/Library +/Perl/5.8.6/constant.pm line 108. Constant subroutine Compress::Zlib::FCOMMENT redefined at /System/Libr +ary/Perl/5.8.6/constant.pm line 108. Constant subroutine Compress::Zlib::NULL redefined at /System/Library/ +Perl/5.8.6/constant.pm line 108. Constant subroutine Compress::Zlib::RESERVED redefined at /System/Libr +ary/Perl/5.8.6/constant.pm line 108. Constant subroutine Compress::Zlib::MIN_HDR_SIZE redefined at /System/ +Library/Perl/5.8.6/constant.pm line 108. Subroutine memGzip redefined at /Library/Perl/5.8.6/darwin-thread-mult +i-2level/Compress/Zlib.pm line 326. Subroutine _removeGzipHeader redefined at /Library/Perl/5.8.6/darwin-t +hread-multi-2level/Compress/Zlib.pm line 357. Subroutine memGunzip redefined at /Library/Perl/5.8.6/darwin-thread-mu +lti-2level/Compress/Zlib.pm line 416. Going to read /Users/dcortesi/.cpan/sources/modules/02packages.details +.txt.gz Deep recursion on subroutine "Compress::Zlib::AUTOLOAD" at /Library/Pe +rl/5.8.6/darwin-thread-multi-2level/Compress/Zlib.pm line 87. ^CCaught SIGINT

2006-09-02 Retitled by jeffa, as per Monastery guidelines
Original title: 'cpan broken in new macpro :-('

Replies are listed 'Best First'.
Re: CPAN.pm broken on new MacPro?
by marto (Cardinal) on Sep 02, 2006 at 10:30 UTC
    Hi thorby,

    I am no cpan expert but as nobody has replied yet I thought I would give it a shot :) A couple of questions, are you logged in as root before running cpan or do you use sudo (for example: sudo cpan or sudo perl -MCPAN -e shell)? Can you post your cpan config (which is cpan> o conf just in case you don't know), It looks like part of the problem may be in retrieving 01mailrc.txt.gz and 02packages.details.txt.gz. I have read posts on newsgroups that in some cases extra command line switches have been added to things like wget which can result in problems when downloading files.

    Hope this helps.

    Martin
      I get the same problem when I use sudo cpan as not (I figured I shouldn't need root access for the i * query). The issue seems to be a recursive loop in /Library/Perl/5.8.6/darwin-thread-multi-2level/Compress/Zlib.pm as evidenced by the "deep recursion" message, followed by a loop which uses little CPU time but nevertheless ties up the system something fierce. When I let this run a while, it finally ends as follows:
      Deep recursion on subroutine "Compress::Zlib::AUTOLOAD" at /Library/Pe +rl/5.8.6/darwin-thread-multi-2level/Compress/Zlib.pm line 87. perl(274) malloc: *** vm_allocate(size=234504192) failed (error code=3 +) perl(274) malloc: *** error: can't allocate region perl(274) malloc: *** set a breakpoint in szone_error to debug Out of memory! Segmentation fault
      ...so it would appear, what is happening is a recursive loop that is eating up virtual memory until finally it fills the swap. The messages about this and that function or constant being redefined might be symptomatic or might be just noise -- however, I have never seen those on any other system, and they make me suspect there is something wrong with this installation. FWIW -- a user of the same OS level on a MacMini has no problem with cpan. Here's the o conf:
      CPAN::Config options from /System/Library/Perl/5.8.6/CPAN/Config.pm an +d /Users/dcortesi/.cpan/CPAN/MyConfig.pm: commit Commit changes to disk defaults Reload defaults from disk init Interactive setting of all options build_cache 5 build_dir /Users/dcortesi/.cpan/build cache_metadata 1 cpan_home /Users/dcortesi/.cpan dontload_hash ftp /usr/bin/ftp ftp_proxy getcwd cwd gpg gzip /sw/bin/gzip histfile /Users/dcortesi/.cpan/histfile histsize 100 http_proxy inactivity_timeout 0 index_expire 1 inhibit_startup_message 0 keep_source_where /Users/dcortesi/.cpan/sources lynx make /usr/bin/make make_arg -j3 make_install_arg UNINST=1 makepl_arg ncftpget /sw/bin/ncftpget no_proxy pager /usr/bin/less prerequisites_policy ask scan_cache atstart shell /bin/tcsh tar /sw/bin/tar term_is_latin 1 unzip /sw/bin/unzip urllist http://www.perl.com/CPAN/ ftp://ftp.duke.edu/pub/perl/ ftp://cpan.uchicago.edu/pub/CPAN/ ftp://archive.progeny.com/CPAN/ wget /sw/bin/wget
Re: CPAN.pm broken on new MacPro?
by calin (Deacon) on Sep 02, 2006 at 20:20 UTC

    I don't usually mess with the system perl (via CPAN etc). I build my own version from source for development and customisation. I think it's generally a good idea to leave the system perl alone.

    (system perl = the version installed by your UNIX distribution from the official packages)

      i can confirm that this problem exists in the macports version of perl, which is in theory completely separate from the system perl. i've got the same problem today: macupdate copied a bunch of PPC perl modules into my new intel mac. i finally gave up on trying to fix the system perl, but this seperate perl install is no cake either ... i will try the renaming suggestion above.