Having Makefile.PL ignore symlinks

petdance on 2006-07-20T06:33:28

In my maintenance of Perl::Critic::Bangs, it's a big PITA (as opposed to PITA) to type in filenames like lib/Perl/Critic/Policy/Bangs/ProhibitStupidCode.pm all the time, so I created symlinks to them in my root directory. Problem is that Makefile.PL thinks that they're part of the distro.

Solution: Override the method libscan() and have it return an empty space if the file is a symlink.

package MY;
sub MY::libscan {
    my $self = shift;
    my $path = shift;

    $path = $self->SUPER::libscan($path);

    # I have a bunch of symlinks in the root.  Ignore them.
    return '' if -l $path;
    return $path;
};