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

I have a set of legacy perl modules that need to stay where they are on the filesystem for backwards compatibility. However, I'd like to make a CPAN-styled perl module distribution out of them. I set up another directory with the standard layout we've all come to know and love, but it's not working for me due to symlinks not being followed.

Inside the lib/ directory, I have a symlink to the directory full of legacy perl modules. Unfortunately, when I do `perl Makefile.PL; make` it doesn't pick up any of the modules because it doesn't follow the symlink. Something that does work is if I make a lib/Legacy directory and then symlink to each individule module. MakeMaker seems to follow symlinks to files but not symlinks to directories.

I don't want to have to symlink each module individually if I could avoid it. What should I do?

Replies are listed 'Best First'.
Re: MakeMaker and Symlinks
by Anonymous Monk on Dec 03, 2004 at 09:42 UTC
    I don't want to have to symlink each module individually if I could avoid it. What should I do?
    Modify whatever magic in MakeMaker (risky) or simply copy (or symlink) each module individually.
    cat Makefile.PL my $to_symlink = '/blah/blah/legacy/lib'; use File::Find; use ExtUtils::Command qw[ mkdir copy ]; my @dirs; my @files; find ( sub { return if $_ =~ /^\.{1,2}$/; if( -d $File::Find::name ){ push @dirs, $File::Find::name; } else { push @files, $File::Find::name; } return;},$to_symlink); s/\Q$to_symlink// for @dirs ; mkpath @dirs; for ( @files ){ my $source = $_; s/\Q$to_symlink//; cp $source, $_; } WriteMakefile( ...
      I'm taking the symlink-every-module-individually approach. It'll do for now, and I don't really feel like modifying MakeMaker. Thanks for the reply.