File Coverage

blib/lib/ExtUtils/InstallPaths.pm
Criterion Covered Total %
statement 129 176 73.3
branch 38 82 46.3
condition 9 25 36.0
subroutine 27 30 90.0
pod 6 6 100.0
total 209 319 65.5


line stmt bran cond sub pod time code
1             package ExtUtils::InstallPaths;
2             {
3             $ExtUtils::InstallPaths::VERSION = '0.010';
4             }
5              
6 1     1   85570 use 5.008001;
  1         4  
  1         117  
7 1     1   7 use strict;
  1         2  
  1         43  
8 1     1   8 use warnings;
  1         2  
  1         31  
9              
10 1     1   5 use File::Spec ();
  1         2  
  1         21  
11 1     1   6 use Carp ();
  1         9  
  1         18  
12 1     1   6 use ExtUtils::Config 0.002;
  1         26  
  1         829  
13              
14             my %complex_accessors = map { $_ => 1 } qw/prefix_relpaths install_sets/;
15             my %hash_accessors = map { $_ => 1 } qw/install_path install_base_relpaths original_prefix /;
16              
17             my %defaults = (
18             installdirs => 'site',
19             install_base => undef,
20             prefix => undef,
21             verbose => 0,
22             blib => 'blib',
23             create_packlist => 1,
24             dist_name => undef,
25             module_name => undef,
26             destdir => undef,
27             install_path => sub { {} },
28             install_sets => \&_default_install_sets,
29             original_prefix => \&_default_original_prefix,
30             install_base_relpaths => \&_default_base_relpaths,
31             prefix_relpaths => \&_default_prefix_relpaths,
32             );
33              
34             sub _merge_shallow {
35 2     2   5 my ($name, $filter) = @_;
36             return sub {
37 1     1   2 my ($override, $config) = @_;
38 1         3 my $defaults = $defaults{$name}->($config);
39 1         18 $filter->($_) for grep $filter, values %$override;
40 1         11 return { %$defaults, %$override };
41             }
42 2         15 }
43              
44             sub _merge_deep {
45 2     2   5 my ($name, $filter) = @_;
46             return sub {
47 3     3   5 my ($override, $config) = @_;
48 3         11 my $defaults = $defaults{$name}->($config);
49             my $pair_for = sub {
50 8         11 my $key = shift;
51 8 100       8 my %override = %{ $override->{$key} || {} };
  8         41  
52 8   100     34 $filter && $filter->($_) for values %override;
53 7         10 return $key => { %{ $defaults->{$key} }, %override };
  7         68  
54 3         18 };
55 3         10 return { map { $pair_for->($_) } keys %$defaults };
  8         17  
56             }
57 2         13 }
58              
59             my %allowed_installdir = map { $_ => 1 } qw/core site vendor/;
60             my $must_be_relative = sub { Carp::croak('Value must be a relative path') if File::Spec->file_name_is_absolute($_[0]) };
61             my %deep_filter = map { $_ => $must_be_relative } qw/install_base_relpaths prefix_relpaths/;
62             my %filter = (
63             installdirs => sub {
64             my $value = shift;
65             $value = 'core', Carp::carp('Perhaps you meant installdirs to be "core" rather than "perl"?') if $value eq 'perl';
66             Carp::croak('installdirs must be one of "core", "site", or "vendor"') if not $allowed_installdir{$value};
67             return $value;
68             },
69             (map { $_ => _merge_shallow($_, $deep_filter{$_}) } qw/original_prefix install_base_relpaths/),
70             (map { $_ => _merge_deep($_, $deep_filter{$_}) } qw/install_sets prefix_relpaths/),
71             );
72              
73             for my $attribute (keys %defaults) {
74 1     1   5 no strict qw/refs/;
  1         2  
  1         2623  
75             *{$attribute} = $hash_accessors{$attribute} ?
76             sub {
77 118     118   168 my ($self, $key) = @_;
78 118 50       236 Carp::confess("$attribute needs key") if not defined $key;
79 118         337 return $self->{$attribute}{$key};
80             } :
81             $complex_accessors{$attribute} ?
82             sub {
83 79     79   159 my ($self, $installdirs, $key) = @_;
84 79 50       154 Carp::confess("$attribute needs installdir") if not defined $installdirs;
85 79 50       141 Carp::confess("$attribute needs key") if not defined $key;
86 79         320 return $self->{$attribute}{$installdirs}{$key};
87             } :
88             sub {
89 325     325   371 my $self = shift;
90 325         936 return $self->{$attribute};
91             };
92             }
93              
94             sub new {
95 13     13 1 10619 my ($class, %args) = @_;
96 13   33     53 my $config = $args{config} || ExtUtils::Config->new;
97 169 100       592 my %self = (
    100          
    100          
98             config => $config,
99 13         66 map { $_ => exists $args{$_} ? $filter{$_} ? $filter{$_}->($args{$_}, $config) : $args{$_} : ref $defaults{$_} ? $defaults{$_}->($config) : $defaults{$_} } keys %defaults,
100             );
101 12 50 33     316 $self{module_name} ||= do { my $module_name = $self{dist_name}; $module_name =~ s/-/::/g; $module_name } if defined $self{dist_name};
  12         21  
  12         41  
  12         43  
102 12         78 return bless \%self, $class;
103             }
104              
105             my @install_sets_keys = qw/lib arch bin script bindoc libdoc binhtml libhtml/;
106             my @install_sets_tail = qw/bin script man1dir man3dir html1dir html3dir/;
107             my %install_sets_values = (
108             core => [ qw/privlib archlib /, @install_sets_tail ],
109             site => [ map { "site$_" } qw/lib arch/, @install_sets_tail ],
110             vendor => [ map { "vendor$_" } qw/lib arch/, @install_sets_tail ],
111             );
112              
113             sub _default_install_sets {
114 12     12   19 my $c = shift;
115              
116 12         18 my %ret;
117 12         23 for my $installdir (qw/core site vendor/) {
118 36         48 @{$ret{$installdir}}{@install_sets_keys} = map { $c->get("install$_") } @{ $install_sets_values{$installdir} };
  36         602  
  288         2866  
  36         83  
119             }
120 12         39 return \%ret;
121             }
122              
123             sub _default_base_relpaths {
124 12     12   18 my $config = shift;
125             return {
126 12         52 lib => ['lib', 'perl5'],
127             arch => ['lib', 'perl5', $config->get('archname')],
128             bin => ['bin'],
129             script => ['bin'],
130             bindoc => ['man', 'man1'],
131             libdoc => ['man', 'man3'],
132             binhtml => ['html'],
133             libhtml => ['html'],
134             };
135             }
136              
137             my %common_prefix_relpaths = (
138             bin => ['bin'],
139             script => ['bin'],
140             bindoc => ['man', 'man1'],
141             libdoc => ['man', 'man3'],
142             binhtml => ['html'],
143             libhtml => ['html'],
144             );
145              
146             sub _default_prefix_relpaths {
147 13     13   23 my $c = shift;
148              
149 13 50       50 my @libstyle = $c->get('installstyle') ? File::Spec->splitdir($c->get('installstyle')) : qw(lib perl5);
150 13         325 my $arch = $c->get('archname');
151 13         169 my $version = $c->get('version');
152              
153             return {
154 13         404 core => {
155             lib => [@libstyle],
156             arch => [@libstyle, $version, $arch],
157             %common_prefix_relpaths,
158             },
159             vendor => {
160             lib => [@libstyle],
161             arch => [@libstyle, $version, $arch],
162             %common_prefix_relpaths,
163             },
164             site => {
165             lib => [@libstyle, 'site_perl'],
166             arch => [@libstyle, 'site_perl', $version, $arch],
167             %common_prefix_relpaths,
168             },
169             };
170             }
171              
172             sub _default_original_prefix {
173 12     12   19 my $c = shift;
174              
175 12 50       32 my %ret = (
176             core => $c->get('installprefixexp'),
177             site => $c->get('siteprefixexp'),
178             vendor => $c->get('usevendorprefix') ? $c->get('vendorprefixexp') : '',
179             );
180              
181 12         5786 return \%ret;
182             }
183              
184             sub _log_verbose {
185 48     48   61 my $self = shift;
186 48 50       83 print @_ if $self->verbose;
187 48         67 return;
188             }
189              
190             # Given a file type, will return true if the file type would normally
191             # be installed when neither install-base nor prefix has been set.
192             # I.e. it will be true only if the path is set from Config.pm or
193             # set explicitly by the user via install-path.
194             sub is_default_installable {
195 0     0 1 0 my $self = shift;
196 0         0 my $type = shift;
197 0   0     0 my $installable = $self->install_destination($type) && ( $self->install_path($type) || $self->install_sets($self->installdirs, $type));
198 0 0       0 return $installable ? 1 : 0;
199             }
200              
201             sub _prefixify_default {
202 24     24   27 my $self = shift;
203 24         28 my $type = shift;
204 24         26 my $rprefix = shift;
205              
206 24         47 my $default = $self->prefix_relpaths($self->installdirs, $type);
207 24 50       53 if( !$default ) {
208 0         0 $self->_log_verbose(" no default install location for type '$type', using prefix '$rprefix'.\n");
209 0         0 return $rprefix;
210             } else {
211 24         32 return File::Spec->catdir(@{$default});
  24         198  
212             }
213             }
214              
215             # Translated from ExtUtils::MM_Unix::prefixify()
216             sub _prefixify_novms {
217 24     24   43 my($self, $path, $sprefix, $type) = @_;
218              
219 24         44 my $rprefix = $self->prefix;
220 24 50       63 $rprefix .= '/' if $sprefix =~ m{/$};
221              
222 24 50 33     167 $self->_log_verbose(" prefixify $path from $sprefix to $rprefix\n") if defined $path && length $path;
223              
224 24 50 33     328 if (not defined $path or length $path == 0 ) {
    50          
    50          
225 0         0 $self->_log_verbose(" no path to prefixify, falling back to default.\n");
226 0         0 return $self->_prefixify_default( $type, $rprefix );
227             } elsif( !File::Spec->file_name_is_absolute($path) ) {
228 0         0 $self->_log_verbose(" path is relative, not prefixifying.\n");
229             } elsif( $path !~ s{^\Q$sprefix\E\b}{}s ) {
230 24         48 $self->_log_verbose(" cannot prefixify, falling back to default.\n");
231 24         50 return $self->_prefixify_default( $type, $rprefix );
232             }
233              
234 0         0 $self->_log_verbose(" now $path in $rprefix\n");
235              
236 0         0 return $path;
237             }
238              
239             sub _catprefix_vms {
240 0     0   0 my ($self, $rprefix, $default) = @_;
241              
242 0         0 my ($rvol, $rdirs) = File::Spec->splitpath($rprefix);
243 0 0       0 if ($rvol) {
244 0         0 return File::Spec->catpath($rvol, File::Spec->catdir($rdirs, $default), '');
245             }
246             else {
247 0         0 return File::Spec->catdir($rdirs, $default);
248             }
249             }
250             sub _prefixify_vms {
251 0     0   0 my($self, $path, $sprefix, $type) = @_;
252 0         0 my $rprefix = $self->prefix;
253              
254 0 0       0 return '' unless defined $path;
255              
256 0         0 $self->_log_verbose(" prefixify $path from $sprefix to $rprefix\n");
257              
258 0         0 require VMS::Filespec;
259             # Translate $(PERLPREFIX) to a real path.
260 0 0       0 $rprefix = VMS::Filespec::vmspath($rprefix) if $rprefix;
261 0 0       0 $sprefix = VMS::Filespec::vmspath($sprefix) if $sprefix;
262              
263 0         0 $self->_log_verbose(" rprefix translated to $rprefix\n sprefix translated to $sprefix\n");
264              
265 0 0       0 if (length($path) == 0 ) {
    0          
    0          
266 0         0 $self->_log_verbose(" no path to prefixify.\n")
267             }
268             elsif (!File::Spec->file_name_is_absolute($path)) {
269 0         0 $self->_log_verbose(" path is relative, not prefixifying.\n");
270             }
271             elsif ($sprefix eq $rprefix) {
272 0         0 $self->_log_verbose(" no new prefix.\n");
273             }
274             else {
275 0         0 my ($path_vol, $path_dirs) = File::Spec->splitpath( $path );
276 0         0 my $vms_prefix = $self->config->get('vms_prefix');
277 0 0       0 if ($path_vol eq $vms_prefix.':') {
278 0         0 $self->_log_verbose(" $vms_prefix: seen\n");
279              
280 0 0       0 $path_dirs =~ s{^\[}{\[.} unless $path_dirs =~ m{^\[\.};
281 0         0 $path = $self->_catprefix_vms($rprefix, $path_dirs);
282             }
283             else {
284 0         0 $self->_log_verbose(" cannot prefixify.\n");
285 0         0 return File::Spec->catdir($self->prefix_relpaths($self->installdirs, $type));
286             }
287             }
288              
289 0         0 $self->_log_verbose(" now $path\n");
290              
291 0         0 return $path;
292             }
293              
294 1 50   1   1099 BEGIN { *_prefixify = $^O eq 'VMS' ? \&_prefixify_vms : \&_prefixify_novms }
295              
296             # Translated from ExtUtils::MM_Any::init_INSTALL_from_PREFIX
297             sub prefix_relative {
298 24     24 1 40 my ($self, $installdirs, $type) = @_;
299              
300 24         47 my $relpath = $self->install_sets($installdirs, $type);
301              
302 24         55 return $self->_prefixify($relpath, $self->original_prefix($installdirs), $type);
303             }
304              
305             sub install_destination {
306 69     69 1 23313 my ($self, $type) = @_;
307              
308 69 50       136 return $self->install_path($type) if $self->install_path($type);
309              
310 69 100       140 if ( $self->install_base ) {
311 23         44 my $relpath = $self->install_base_relpaths($type);
312 23 50       66 return $relpath ? File::Spec->catdir($self->install_base, @{$relpath}) : undef;
  23         234  
313             }
314              
315 46 100       91 if ( $self->prefix ) {
316 24         47 my $relpath = $self->prefix_relative($self->installdirs, $type);
317 24 50       76 return $relpath ? File::Spec->catdir($self->prefix, $relpath) : undef;
318             }
319 22         41 return $self->install_sets($self->installdirs, $type);
320             }
321              
322             sub install_types {
323 3     3 1 9 my $self = shift;
324              
325 3         11 my %types = ( %{ $self->{install_path} },
  1         6  
326 0         0 $self->install_base ? %{ $self->{install_base_relpaths} }
327 2         5 : $self->prefix ? %{ $self->{prefix_relpaths}{ $self->installdirs } }
328 3 50       4 : %{ $self->{install_sets}{ $self->installdirs } });
    100          
329              
330 3         154 return sort keys %types;
331             }
332              
333             sub install_map {
334 2     2 1 12 my ($self, $blib) = @_;
335 2   33     12 $blib ||= $self->blib;
336              
337 2         4 my (%map, @skipping);
338 2         7 foreach my $type ($self->install_types) {
339 16         77 my $localdir = File::Spec->catdir($blib, $type);
340 16 100       244 next unless -e $localdir;
341              
342             # the line "...next if (($type eq 'bindoc'..." was one of many changes introduced for
343             # improving HTML generation on ActivePerl, see https://rt.cpan.org/Public/Bug/Display.html?id=53478
344             # Most changes were ok, but this particular line caused test failures in t/manifypods.t on windows,
345             # therefore it is commented out.
346              
347             # ********* next if (($type eq 'bindoc' || $type eq 'libdoc') && not $self->is_unixish);
348              
349 8 50       16 if (my $dest = $self->install_destination($type)) {
350 8         25 $map{$localdir} = $dest;
351             } else {
352 0         0 push @skipping, $type;
353             }
354             }
355              
356 2 50       10 warn "WARNING: Can't figure out install path for types: @skipping\nFiles will not be installed.\n" if @skipping;
357              
358             # Write the packlist into the same place as ExtUtils::MakeMaker.
359 2 50 33     6 if ($self->create_packlist and my $module_name = $self->module_name) {
360 2         6 my $archdir = $self->install_destination('arch');
361 2         9 my @ext = split /::/, $module_name;
362 2         27 $map{write} = File::Spec->catfile($archdir, 'auto', @ext, '.packlist');
363             }
364              
365             # Handle destdir
366 2 50 50     7 if (length(my $destdir = $self->destdir || '')) {
367 0         0 foreach (keys %map) {
368             # Need to remove volume from $map{$_} using splitpath, or else
369             # we'll create something crazy like C:\Foo\Bar\E:\Baz\Quux
370             # VMS will always have the file separate than the path.
371 0         0 my ($volume, $path, $file) = File::Spec->splitpath( $map{$_}, 0 );
372              
373             # catdir needs a list of directories, or it will create something
374             # crazy like volume:[Foo.Bar.volume.Baz.Quux]
375 0         0 my @dirs = File::Spec->splitdir($path);
376              
377             # First merge the directories
378 0         0 $path = File::Spec->catdir($destdir, @dirs);
379              
380             # Then put the file back on if there is one.
381 0 0       0 if ($file ne '') {
382 0         0 $map{$_} = File::Spec->catfile($path, $file)
383             } else {
384 0         0 $map{$_} = $path;
385             }
386             }
387             }
388              
389 2         5 $map{read} = ''; # To keep ExtUtils::Install quiet
390              
391 2         7 return \%map;
392             }
393              
394             1;
395              
396             # ABSTRACT: Build.PL install path logic made easy
397              
398             __END__
399              
400             =pod
401              
402             =head1 NAME
403              
404             ExtUtils::InstallPaths - Build.PL install path logic made easy
405              
406             =head1 VERSION
407              
408             version 0.010
409              
410             =head1 SYNOPSIS
411              
412             use ExtUtils::InstallPaths;
413             use ExtUtils::Install 'install';
414             GetOptions(\my %opt, 'install_base=s', 'install_path=s%', 'installdirs=s', 'destdir=s', 'prefix=s', 'uninst:1', 'verbose:1');
415             my $paths = ExtUtils::InstallPaths->new(%opt, dist_name => $dist_name);
416             install($paths->install_map, $opt{verbose}, 0, $opt{uninst});
417              
418             =head1 DESCRIPTION
419              
420             This module tries to make install path resolution as easy as possible.
421              
422             When you want to install a module, it needs to figure out where to install things. The nutshell version of how this works is that default installation locations are determined from L<ExtUtils::Config>, and they may be individually overridden by using the C<install_path> attribute. An C<install_base> attribute lets you specify an alternative installation root like F</home/foo> and C<prefix> does something similar in a rather different (and more complicated) way. C<destdir> lets you specify a temporary installation directory like F</tmp/install> in case you want to create bundled-up installable packages.
423              
424             The following types are supported by default.
425              
426             =over 4
427              
428             =item * lib
429              
430             Usually pure-Perl module files ending in F<.pm> or F<.pod>.
431              
432             =item * arch
433              
434             "Architecture-dependent" module files, usually produced by compiling XS, L<Inline>, or similar code.
435              
436             =item * script
437              
438             Programs written in pure Perl. In order to improve reuse, you may want to make these as small as possible - put the code into modules whenever possible.
439              
440             =item * bin
441              
442             "Architecture-dependent" executable programs, i.e. compiled C code or something. Pretty rare to see this in a perl distribution, but it happens.
443              
444             =item * bindoc
445              
446             Documentation for the stuff in C<script> and C<bin>. Usually generated from the POD in those files. Under Unix, these are manual pages belonging to the 'man1' category. Unless explicitly set, this is only available on platforms supporting manpages.
447              
448             =item * libdoc
449              
450             Documentation for the stuff in C<lib> and C<arch>. This is usually generated from the POD in F<.pm> and F<.pod> files. Under Unix, these are manual pages belonging to the 'man3' category. Unless explicitly set, this is only available on platforms supporting manpages.
451              
452             =item * binhtml
453              
454             This is the same as C<bindoc> above, but applies to HTML documents. Unless explicitly set, this is only available when perl was configured to do so.
455              
456             =item * libhtml
457              
458             This is the same as C<libdoc> above, but applies to HTML documents. Unless explicitly set, this is only available when perl was configured to do so.
459              
460             =back
461              
462             =head1 ATTRIBUTES
463              
464             =head2 installdirs
465              
466             The default destinations for these installable things come from entries in your system's configuration. You can select from three different sets of default locations by setting the C<installdirs> parameter as follows:
467              
468             'installdirs' set to:
469             core site vendor
470              
471             uses the following defaults from ExtUtils::Config:
472              
473             lib => installprivlib installsitelib installvendorlib
474             arch => installarchlib installsitearch installvendorarch
475             script => installscript installsitescript installvendorscript
476             bin => installbin installsitebin installvendorbin
477             bindoc => installman1dir installsiteman1dir installvendorman1dir
478             libdoc => installman3dir installsiteman3dir installvendorman3dir
479             binhtml => installhtml1dir installsitehtml1dir installvendorhtml1dir [*]
480             libhtml => installhtml3dir installsitehtml3dir installvendorhtml3dir [*]
481              
482             * Under some OS (eg. MSWin32) the destination for HTML documents is determined by the C<Config.pm> entry C<installhtmldir>.
483              
484             The default value of C<installdirs> is "site".
485              
486             =head2 install_base
487              
488             You can also set the whole bunch of installation paths by supplying the C<install_base> parameter to point to a directory on your system. For instance, if you set C<install_base> to "/home/ken" on a Linux system, you'll install as follows:
489              
490             lib => /home/ken/lib/perl5
491             arch => /home/ken/lib/perl5/i386-linux
492             script => /home/ken/bin
493             bin => /home/ken/bin
494             bindoc => /home/ken/man/man1
495             libdoc => /home/ken/man/man3
496             binhtml => /home/ken/html
497             libhtml => /home/ken/html
498              
499             =head2 prefix
500              
501             This sets a prefix, identical to ExtUtils::MakeMaker's PREFIX option. This does something similar to C<install_base> in a much more complicated way.
502              
503             =head2 config()
504              
505             The L<ExtUtils::Config|ExtUtils::Config> object used for this object.
506              
507             =head2 verbose
508              
509             The verbosity of ExtUtils::InstallPaths. It defaults to 0
510              
511             =head2 blib
512              
513             The location of the blib directory, it defaults to 'blib'.
514              
515             =head2 create_packlist
516              
517             Together with C<module_name> this controls whether a packlist will be added; it defaults to 1.
518              
519             =head2 dist_name
520              
521             The name of the current module.
522              
523             =head2 module_name
524              
525             The name of the main module of the package. This is required for packlist creation, but in the future it may be replaced by dist_name. It defaults to C<dist_name =~ s/-/::/gr> if dist_name is set.
526              
527             =head2 destdir
528              
529             If you want to install everything into a temporary directory first (for instance, if you want to create a directory tree that a package manager like C<rpm> or C<dpkg> could create a package from), you can use the C<destdir> parameter. E.g. Setting C<destdir> to C<"/tmp/foo"> will effectively install to "/tmp/foo/$sitelib", "/tmp/foo/$sitearch", and the like, except that it will use C<File::Spec> to make the pathnames work correctly on whatever platform you're installing on.
530              
531             =head1 METHODS
532              
533             =head2 new
534              
535             Create a new ExtUtils::InstallPaths object. B<All attributes are valid arguments> to the constructor, as well as this:
536              
537             =over 4
538              
539             =item * install_path
540              
541             This must be a hashref with the type as keys and the destination as values.
542              
543             =item * install_base_relpaths
544              
545             This must be a hashref with types as keys and a path relative to the install_base as value.
546              
547             =item * prefix_relpaths
548              
549             This must be a hashref any of these three keys: core, vendor, site. Each of the values mush be a hashref with types as keys and a path relative to the prefix as value. You probably want to make these three hashrefs identical.
550              
551             =item * original_prefix
552              
553             This must be a hashref with the legal installdirs values as keys and the prefix directories as values.
554              
555             =item * install_sets
556              
557             This mush be a hashref with the legal installdirs are keys, and the values being hashrefs with types as keys and locations as values.
558              
559             =back
560              
561             =head2 install_map()
562              
563             Return a map suitable for use with L<ExtUtils::Install>. B<In most cases, this is the only method you'll need>.
564              
565             =head2 install_destination($type)
566              
567             Returns the destination of a certain type.
568              
569             =head2 install_types()
570              
571             Return a list of all supported install types in the current configuration.
572              
573             =head2 is_default_installable($type)
574              
575             Given a file type, will return true if the file type would normally be installed when neither install-base nor prefix has been set. I.e. it will be true only if the path is set from the configuration object or set explicitly by the user via install_path.
576              
577             =head2 install_path($type)
578              
579             Gets the install path for a certain type.
580              
581             =head2 install_sets($installdirs, $type)
582              
583             Get the path for a certain C<$type> with a certain C<$installdirs>.
584              
585             =head2 install_base_relpaths($type, $relpath)
586              
587             Get the relative paths for use with install_base for a certain type.
588              
589             =head2 prefix_relative($installdirs, $type)
590              
591             Gets the path of a certain C<$type> and C<$installdirs> relative to the prefix.
592              
593             =head2 prefix_relpaths($install_dirs, $type)
594              
595             Get the default relative path to use in case the config install paths cannot be prefixified. You do not want to use this to get any relative path, but may require it to set it for custom types.
596              
597             =head2 original_prefix($installdirs)
598              
599             Get the original prefix for a certain type of $installdirs.
600              
601             =head1 SEE ALSO
602              
603             =over 4
604              
605             =item * L<Build.PL spec|http://github.com/dagolden/cpan-api-buildpl/blob/master/lib/CPAN/API/BuildPL.pm>
606              
607             =back
608              
609             =head1 AUTHORS
610              
611             =over 4
612              
613             =item *
614              
615             Ken Williams <kwilliams@cpan.org>
616              
617             =item *
618              
619             Leon Timmermans <leont@cpan.org>
620              
621             =back
622              
623             =head1 COPYRIGHT AND LICENSE
624              
625             This software is copyright (c) 2011 by Ken Williams, Leon Timmermans.
626              
627             This is free software; you can redistribute it and/or modify it under
628             the same terms as the Perl 5 programming language system itself.
629              
630             =cut