1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
|
#-------------------------------------------------------------------------------
# This file was auto-generated by Devel::MaintBlead 0.08 on
# Fri Dec 7 16:00:11 2012.
# can also be called from Devel::MaintBlead, we need the main:: package
package main;
# mark that we've run this (for testing mostly)
$Devel::MaintBlead::SIZE= 5642;
# huh?
if ( !$LIB_TREE or !$REQUIRED ) {
print STDERR <<'HUH';
Please make sure the global variables $LIB_TREE and $REQUIRED are set before
using the Devel::MaintBlead module in your Makefile.PL.
HUH
exit 1;
}
# private initializations
my @lib_tree= split "/", $LIB_TREE;
$lib_tree[$_]= "$lib_tree[ $_ - 1 ]/$lib_tree[$_]" foreach 1 .. $#lib_tree;
my @postfix= qw( blead maint );
my %maint= map { $postfix[$_] => $_ } 0 .. $#postfix;
my $auto_maint= ( $] < $REQUIRED ) || 0;
#-------------------------------------------------------------------------------
# set up file moving primitive
use File::Copy ();
sub mv {
if ( -e $_[1] ) {
print STDERR <<"HUH";
Cowardly refusing to overwrite
$_[1]
from
$_[0]
This should not happen. Please advise the author of Devel::MaintBlead on
how you managed to do this. Thank you!
HUH
exit 1;
}
return File::Copy::mv(@_);
} #mv
#-------------------------------------------------------------------------------
# set up file moving logic
#
# IN: 1 "from" interpolation
# 2 "to" interpolation
# 3 lib_tree setting (default: $LIB_TREE)
sub mv_all {
my ( $from, $to, $lib_tree )= @_;
# move generic files
if ( !$lib_tree ) {
mv "MANIFEST$from", "MANIFEST$to"
or die "Could not move file MANIFEST$from -> $to: $!\n";
foreach ( map { m#/([^/\.]+\.t)$from$# } glob( "t$from/*$from" ) ) {
mv "t$from/$_$from", "t$to/$_$to"
or die "Could not move file t$from/$_$from -> $to: $!\n";
}
# use the base lib_tree
$lib_tree= $LIB_TREE;
}
# just make sure it exists
else {
mkdir "lib$to/$lib_tree";
}
# move lib files here
foreach ( map { m#/([^/\.]+\.pm)$from$# }
glob( "lib$from/$lib_tree/*$from" ) ) {
mv "lib$from/$lib_tree/$_$from", "lib$to/$lib_tree/$_$to"
or die "Could not move file $lib$from/$lib_tree/$_$from -> $to: $!\n";
}
# remove now possibly empty subdirectories
rmdir "lib$from/$lib_tree" if $from;
# move them there for all subdirs
mv_all( $from, $to, "$lib_tree/$_" )
foreach map { m#/([^/]+)$# } grep { -d } glob "lib$from/$lib_tree/*";
} #mv_all
#-------------------------------------------------------------------------------
# unlink_all
#
# IN: 1 initial directory to remove files from
sub unlink_all {
my ($dir)= @_;
# remove all files from this dir (don't care whether worked)
unlink glob "$dir/*";
# recursively unlink all files in all directories
unlink_all($_)
foreach grep { -d } glob "$dir/*";
} #unlink_all
#-------------------------------------------------------------------------------
# first time running Makefile.PL
if ( !-e 'pm_to_blib' ) {
# set default setting
$MAINT= !glob( "lib_$postfix[1]/$LIB_TREE/*" ) || 0;
open( OUT, ">default" );
print OUT $postfix[$MAINT];
close OUT;
}
# extract override if there is one
my $type;
@ARGV=
grep { defined $maint{$_} ? ( $type= $_, $MAINT= $maint{$_}, 0 ) : 1 } @ARGV;
# we have an override
if ($type) {
print STDERR "Forcing to use the '$type' version of the code\n";
open( OUT, ">default" );
print OUT $postfix[$MAINT];
close OUT;
}
# get default setting if necessary
else {
open( IN, 'default' );
$MAINT= $maint{ <IN> };
close IN;
}
# sorry, we can't help you
if ( $auto_maint and !$MAINT ) {
# can't do blead, autoselect active, so go to maint
if ( $ENV{AUTO_SELECT_MAINT_OR_BLEAD} ) {
$MAINT=1;
}
# alas, can't do blead
else {
$REQUIRED= sprintf '%1.6f', $REQUIRED;
print STDERR <<"SORRY";
This distribution requires at least Perl $REQUIRED to be installed. Since this
is an older distribution, with a history spanning almost a decade, it is also
available inside this distribution as a previous incarnation, which is actively
maintained as well.
You can install that version of this distribution by running this $0
with the additional "maint" parameter, like so:
$^X $0 maint @ARGV
Or you can provide an automatic selection behavior, which would automatically
select and install the right version of this distribution for the version of
Perl provided, by setting the AUTO_SELECT_MAINT_OR_BLEAD environment variable
to a true value. On Unix-like systems like so:
AUTO_SELECT_MAINT_OR_BLEAD=1 $^X $0 @ARGV
Thank you for your attention.
SORRY
my $line= (caller)[2];
eval <<"BYEBYE" or print STDERR $@;
#line $line $0
require $REQUIRED;
BYEBYE
exit 1;
}
}
# create shortcuts
my $this= $postfix[$MAINT];
my $that= $postfix[ !$MAINT ];
# make sure empty directories exist, 'make dist' doesn't include them
foreach my $postfix (@postfix) {
mkdir "lib_$postfix";
mkdir "lib_$postfix/$_" foreach @lib_tree;
mkdir "t_$postfix";
}
# need to move files into place
if ( my @files= glob( "lib_$this/$LIB_TREE/*" ) ) {
print STDERR "Moving $this files into position\n";
# move current files away
mv_all( '', "_$that" );
# put files into place
mv_all( "_$this", '' );
# make sure we will copy to blib
unlink_all("blib/lib/$LIB_TREE/*");
}
# right files already there
else {
print STDERR "Files for $this already in position\n";
}
|