#------------------------------------------------------------------------------- # 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{ }; 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"; }