[Module-build-checkins] Module-Build/lib/Module/Build Base.pm,1.430,1.431
Status: Beta
Brought to you by:
kwilliams
|
From: Michael G S. <sc...@us...> - 2005-06-21 23:16:30
|
Update of /cvsroot/module-build/Module-Build/lib/Module/Build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4114/lib/Module/Build Modified Files: Base.pm Log Message: Add defaults for prefixification to use in case the install location is outside the config prefix. _catprefix() was busted because splitpath considers the last thing on a path to be a file in Unix. It can't distinguish between directories and files. We just assume its a directory. Throughly test prefixifcation defaults. Index: Base.pm =================================================================== RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build/Base.pm,v retrieving revision 1.430 retrieving revision 1.431 diff -u -d -r1.430 -r1.431 --- Base.pm 21 Jun 2005 22:49:30 -0000 1.430 +++ Base.pm 21 Jun 2005 23:16:18 -0000 1.431 @@ -2574,7 +2574,9 @@ my ($self, $type, $prefix) = @_; my $c = $self->{config}; - my $map = $self->install_sets; + my $map = $self->install_sets; + my $defaults = $self->_prefix_defaults; + my $installdirs = $self->installdirs; return unless exists $map->{$installdirs}{$type}; @@ -2587,16 +2589,55 @@ ); $prefixes{site} ||= $prefixes{core}; - my $default; - return $self->_prefixify($map->{$installdirs}{$type}, $prefixes{$installdirs}, $prefix, - $default + $defaults->{$installdirs}{$type} ); } +# Defaults to use in case the config install paths cannot be prefixified. +sub _prefix_defaults { + my $self = shift; + my $c = $self->{config}; + + my $libstyle = $c->{installstyle} || 'lib/perl5'; + my $arch = $c->{archname}; + my $version = $c->{version}; + + my %defaults = ( + core => { + lib => $libstyle, + arch => File::Spec->catdir($libstyle, $version, $arch), + bin => 'bin', + script => 'bin', + libdoc => 'man/man3', + bindoc => 'man/man1', + }, + vendor => { + lib => $libstyle, + arch => File::Spec->catdir($libstyle, $version, $arch), + bin => 'bin', + script => 'bin', + libdoc => 'man/man3', + bindoc => 'man/man1', + }, + site => { + lib => File::Spec->catdir($libstyle, 'site_perl'), + arch => File::Spec->catdir($libstyle, 'site_perl', + $version, $arch), + bin => 'bin', + script => 'bin', + libdoc => 'man/man3', + bindoc => 'man/man1', + }, + ); + + return \%defaults; +} + + # Translated from ExtUtils::MM_Unix::prefixify() sub _prefixify { my($self, $path, $sprefix, $rprefix, $default) = @_; @@ -2649,15 +2690,17 @@ sub _catprefix { my($self, $rprefix, $default) = @_; - my($rvol, $rdirs) = File::Spec->splitpath($rprefix); + # Most file path types do not distinguish between a file and a directory + # so the "file" part here is usually part of the directory. + my($rvol, @rdirs) = File::Spec->splitpath($rprefix); if( $rvol ) { return File::Spec->catpath($rvol, - File::Spec->catdir($rdirs, $default), + File::Spec->catdir(@rdirs, $default), '' ) } else { - return File::Spec->catdir($rdirs, $default); + return File::Spec->catdir(@rdirs, $default); } } |