Perl-Dist-WiX

changeset 1056:ef2ef60ce746

Eliminated Perl::Dist::WiX::Toolchain.
author Curtis Jewell <perl@curtisjewell.name>
date Sun Jun 12 23:04:51 2011 -0600 (2011-06-12)
parents 6027d640fe54
children 3622630c0e90
files Build.PL lib/Perl/Dist/WiX.pm lib/Perl/Dist/WiX/Mixin/BuildPerl.pm lib/Perl/Dist/WiX/Toolchain.pm
line diff
     1.1 --- a/Build.PL	Sun Jun 12 19:47:53 2011 -0600
     1.2 +++ b/Build.PL	Sun Jun 12 23:04:51 2011 -0600
     1.3 @@ -70,11 +70,10 @@
     1.4  		'Params::Util'               => '0.35',
     1.5  		'Portable::Dist'             => '0.03',
     1.6  		'Probe::Perl'                => '0.01',
     1.7 -		'Process'                    => '0.26',
     1.8  		'Readonly'                   => '1.03',
     1.9  		# Template 2.21 will not install on Windows, anyway.
    1.10  		'Template'                   => '2.22',
    1.11 -		'Template::Alloy'            => '',
    1.12 +		'Template::Alloy'            => '1.016',
    1.13  		'URI'                        => '1.35',
    1.14  		'WiX3'                       => '0.010004',
    1.15  		'YAML::Tiny'                 => '1.36',
     2.1 --- a/lib/Perl/Dist/WiX.pm	Sun Jun 12 19:47:53 2011 -0600
     2.2 +++ b/lib/Perl/Dist/WiX.pm	Sun Jun 12 23:04:51 2011 -0600
     2.3 @@ -1977,16 +1977,6 @@
     2.4  
     2.5  
     2.6  
     2.7 -has '_toolchain' => (
     2.8 -	is       => 'bare',
     2.9 -	isa      => 'Maybe[Perl::Dist::WiX::Toolchain]',
    2.10 -	reader   => '_get_toolchain',
    2.11 -	writer   => '_set_toolchain',
    2.12 -	init_arg => undef,
    2.13 -);
    2.14 -
    2.15 -
    2.16 -
    2.17  has '_build_start_time' => (
    2.18  	is       => 'ro',
    2.19  	isa      => Int,
    2.20 @@ -5381,8 +5371,8 @@
    2.21  1.00, L<IO::String|IO::String> 1.08, L<List::MoreUtils|List::MoreUtils> 0.07, 
    2.22  L<Module::CoreList|Module::CoreList> 2.32, L<Win32::Exe|Win32::Exe> 0.13, 
    2.23  L<Object::InsideOut|Object::InsideOut> 3.53, L<Perl::Dist|Perl::Dist> 1.14, 
    2.24 -L<Process|Process> 0.26, L<Readonly|Readonly> 1.03, L<URI|URI> 1.35, and 
    2.25 -L<Win32|Win32> 0.35.
    2.26 +L<Template::Alloy|Template::Alloy> 1.016, L<Readonly|Readonly> 1.03, 
    2.27 +L<URI|URI> 1.35, and L<Win32|Win32> 0.35.
    2.28  
    2.29  =for readme stop
    2.30  
     3.1 --- a/lib/Perl/Dist/WiX/Mixin/BuildPerl.pm	Sun Jun 12 19:47:53 2011 -0600
     3.2 +++ b/lib/Perl/Dist/WiX/Mixin/BuildPerl.pm	Sun Jun 12 23:04:51 2011 -0600
     3.3 @@ -43,7 +43,6 @@
     3.4  use IO::Capture::Stderr               qw();
     3.5  use Perl::Dist::WiX::Asset::Perl      qw();
     3.6  use Template::Alloy                   qw();
     3.7 -#use Perl::Dist::WiX::Toolchain        qw();
     3.8  #>>>
     3.9  
    3.10  our $VERSION = '1.550';
    3.11 @@ -83,17 +82,6 @@
    3.12    Thread::Queue
    3.13  );
    3.14  
    3.15 -has '_perl_toolchain' => (
    3.16 -	traits   => ['Array'],
    3.17 -	is       => 'bare',
    3.18 -	isa      => ArrayRef [Str],
    3.19 -	builder  => '_build_perl_toolchain',
    3.20 -	init_arg => undef,
    3.21 -	lazy     => 1,
    3.22 -	handles  => {
    3.23 -		'_get_toolchain' => 'elements',
    3.24 -	},
    3.25 -);
    3.26  
    3.27  
    3.28  sub _delay_upgrade {
    3.29 @@ -451,6 +439,10 @@
    3.30  sub install_perl {
    3.31  	my $self = shift;
    3.32  
    3.33 +	# Make the perl directory if it hasn't been made already.
    3.34 +	$self->make_path( $self->dir('perl') );
    3.35 +
    3.36 +	# Actually do the installation.
    3.37  	$self->_install_perl_plugin();
    3.38  
    3.39  	# Should have a perl to use now.
    3.40 @@ -487,7 +479,7 @@
    3.41  
    3.42  
    3.43  
    3.44 -sub _build_perl_toolchain { ## no critic(ProhibitUnusedPrivateSubroutines)
    3.45 +sub _get_toolchain {
    3.46  	my $self = shift;
    3.47  	my $cpan = $self->cpan();
    3.48  
    3.49 @@ -510,21 +502,23 @@
    3.50  
    3.51  	my $corelist_version = $self->perl_version_literal() + 0;
    3.52  	my $corelist_hash    = $Module::CoreList::version{$corelist_version};
    3.53 -	my @dists;
    3.54 +	my @dists = ();
    3.55  
    3.56  	my $stdout = IO::Capture::Stdout->new();
    3.57  	my $stderr = IO::Capture::Stderr->new();
    3.58 -	$stdout->start();
    3.59 -	$stderr->start();
    3.60  
    3.61  	# Load the latest index
    3.62  	local $SIG{__WARN__} = sub {1};
    3.63 +	$stdout->start();
    3.64 +	$stderr->start();
    3.65  	if ( not $CPAN::Config_loaded++ ) {
    3.66  		CPAN::HandleConfig->load();
    3.67  	}
    3.68 -	$CPAN::Config->{'urllist'}    = [ $self->_get_cpan() ];
    3.69 +	$CPAN::Config->{'urllist'}    = [ "$cpan" ];
    3.70  	$CPAN::Config->{'use_sqlite'} = q[0];
    3.71  	CPAN::Index->reload();
    3.72 +	$stdout->stop();
    3.73 +	$stderr->stop();
    3.74  
    3.75  	foreach
    3.76  	  my $name ( @{ $self->_toolchain_modules() } )
    3.77 @@ -539,8 +533,6 @@
    3.78  		my $module = CPAN::Shell->expand( 'Module', $name );
    3.79  
    3.80  		if ( not $module ) {
    3.81 -			$stdout->stop();
    3.82 -			$stderr->stop();
    3.83  			PDWiX->throw("Failed to find '$name'");
    3.84  		}
    3.85  
    3.86 @@ -567,18 +559,11 @@
    3.87  		push @dists, $file;
    3.88  	} ## end foreach my $name ( @{ $self...})
    3.89  
    3.90 -	$stdout->stop();
    3.91 -	$stderr->stop();
    3.92 -	
    3.93  	# Remove duplicates.
    3.94  	my %seen = ();
    3.95  	my @final_dists = grep { !$seen{$_}++ } @dists;
    3.96 -	
    3.97 -	my $s = join "\n    ", 'List of toolchain dists:', @final_dists; 
    3.98 -	$self->trace_line(1, "$s\n");
    3.99 -	PDWiX::Stop->throw();
   3.100 -	
   3.101 -	return \@final_dists;
   3.102 +
   3.103 +	return @final_dists;
   3.104  } ## end sub _create_perl_toolchain
   3.105  
   3.106  
   3.107 @@ -603,8 +588,8 @@
   3.108  	my $self = shift;
   3.109  
   3.110  	# Retrieves and verifies the toolchain.
   3.111 -	my $toolchain = $self->_get_toolchain();
   3.112 -	if ( 0 == $toolchain->dist_count() ) {
   3.113 +	my @toolchain = $self->_get_toolchain();
   3.114 +	if ( 0 == scalar @toolchain ) {
   3.115  		PDWiX->throw('Toolchain did not get collected');
   3.116  	}
   3.117  
   3.118 @@ -612,7 +597,7 @@
   3.119  	my ( $core, $module_id );
   3.120  	my $perl_version  = $self->perl_version_literal();
   3.121  	my $default_force = $self->force();
   3.122 -	foreach my $dist ( $toolchain->get_dists() ) {
   3.123 +	foreach my $dist ( @toolchain ) {
   3.124  		my $automated_testing = 0;
   3.125  		my $release_testing   = 0;
   3.126  		my $overwritable      = 0;
     4.1 --- a/lib/Perl/Dist/WiX/Toolchain.pm	Sun Jun 12 19:47:53 2011 -0600
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,651 +0,0 @@
     4.4 -package Perl::Dist::WiX::Toolchain;
     4.5 -
     4.6 -=pod
     4.7 -
     4.8 -=head1 NAME
     4.9 -
    4.10 -Perl::Dist::WiX::Toolchain - Compiles the initial toolchain for a Win32 perl distribution.
    4.11 -
    4.12 -=head1 VERSION
    4.13 -
    4.14 -This document describes Perl::Dist::WiX::Toolchain version 1.550.
    4.15 -
    4.16 -=head1 SYNOPSIS
    4.17 -
    4.18 -  my $toolchain = Perl::Dist::WiX::Toolchain->new(
    4.19 -    perl_version => '5.012000',       # This is as could be returned from $].
    4.20 -	cpan         => URI::file('C:\\minicpan\'),
    4.21 -	bits         => 32,
    4.22 -  );
    4.23 -  
    4.24 -  $toolchain->delegate() or die $toolchain->get_error();
    4.25 -  
    4.26 -  my @dists;
    4.27 -  if (0 < $toolchain->dist_count()) {
    4.28 -	@dists = $toolchain->get_dists();
    4.29 -  }
    4.30 -  
    4.31 -  ...
    4.32 -  
    4.33 -
    4.34 -=head1 DESCRIPTION
    4.35 -
    4.36 -This module starts up a copy of the running perl (NOT the perl being built)
    4.37 -in order to determine what modules are in the "initial toolchain" and need
    4.38 -to be upgraded or installed immediately.
    4.39 -
    4.40 -The "initial toolchain" is the modules that are required for L<CPAN|CPAN>, 
    4.41 -L<Module::Build|Module::Build>, L<ExtUtils::MakeMaker|ExtUtils::MakeMaker>,
    4.42 -and L<CPANPLUS|CPANPLUS> (for 5.10.x+ versions of Perl) to be able to
    4.43 -install additional modules.
    4.44 -
    4.45 -It does not include L<DBD::SQLite|DBD::SQLite> or the modules that are 
    4.46 -required in order for C<CPAN> or C<CPANPLUS> to use it.
    4.47 -
    4.48 -It is a subclass of L<Process::Delegatable|Process::Delegatable> and of
    4.49 -L<Process|Process>.
    4.50 -
    4.51 -=cut
    4.52 -
    4.53 -
    4.54 -
    4.55 -use 5.010;
    4.56 -use Moose 0.90;
    4.57 -use MooseX::NonMoose;
    4.58 -use MooseX::Types::Moose qw( Str Int Bool HashRef ArrayRef Maybe );
    4.59 -use MooseX::Types::URI qw( Uri );
    4.60 -use Moose::Util::TypeConstraints;
    4.61 -use English qw( -no_match_vars );
    4.62 -use Carp qw();
    4.63 -use Params::Util qw( _HASH );
    4.64 -use Module::CoreList 2.49 qw();
    4.65 -use IO::Capture::Stdout qw();
    4.66 -use IO::Capture::Stderr qw();
    4.67 -use vars qw(@DELEGATE);
    4.68 -use namespace::clean -except => 'meta';
    4.69 -
    4.70 -our $VERSION = '1.550';
    4.71 -
    4.72 -extends qw(
    4.73 -  Process::Delegatable
    4.74 -  Process
    4.75 -);
    4.76 -
    4.77 -
    4.78 -
    4.79 -=head1 METHODS
    4.80 -
    4.81 -=head2 new
    4.82 -
    4.83 -This method creates a Perl::Dist::WiX::Toolchain object.
    4.84 -
    4.85 -See L<Process/new|Process-E<gt>new> for more information.
    4.86 -
    4.87 -The possible parameters that this class defines are as follows:
    4.88 -
    4.89 -=cut
    4.90 -
    4.91 -
    4.92 -
    4.93 -# This is called by Moose::Object->new(), and just checks that we passed
    4.94 -# in a version of Perl that we know how to handle.
    4.95 -sub BUILD {
    4.96 -	my $self  = shift;
    4.97 -	my $class = ref $self;
    4.98 -
    4.99 -	if ( not $self->_modules_exists( $self->_get_perl_version() ) ) {
   4.100 -		Carp::croak( q{Perl version '}
   4.101 -			  . $self->_get_perl_version()
   4.102 -			  . "' is not supported in $class" );
   4.103 -	}
   4.104 -	if ( not $self->_corelist_version_exists( $self->_get_perl_version() ) )
   4.105 -	{
   4.106 -		Carp::croak( q{Perl version '}
   4.107 -			  . $self->_get_perl_version()
   4.108 -			  . "' is not supported in $class" );
   4.109 -	}
   4.110 -
   4.111 -} ## end sub BUILD
   4.112 -
   4.113 -
   4.114 -
   4.115 -
   4.116 -
   4.117 -=head3 perl_version
   4.118 -
   4.119 -This required parameter defines the version of Perl that we are generating 
   4.120 -the toolchain for.
   4.121 -
   4.122 -This is a string containing a number that is a version of perl in the format
   4.123 -of $] ('5.010001' or '5.012000', for example).
   4.124 -
   4.125 -=cut
   4.126 -
   4.127 -
   4.128 -
   4.129 -has perl_version => (
   4.130 -	is       => 'ro',
   4.131 -	isa      => Str,
   4.132 -	reader   => '_get_perl_version',
   4.133 -	required => 1,
   4.134 -);
   4.135 -
   4.136 -
   4.137 -
   4.138 -
   4.139 -has force => (
   4.140 -	traits  => ['Hash'],
   4.141 -	is      => 'ro',
   4.142 -	isa     => HashRef,
   4.143 -	default => sub { return {} },
   4.144 -	handles => {
   4.145 -		'_force_exists'    => 'exists',
   4.146 -		'_get_forced_dist' => 'get',
   4.147 -	},
   4.148 -);
   4.149 -
   4.150 -
   4.151 -
   4.152 -=head3 cpan
   4.153 -
   4.154 -This required parameter defines the CPAN mirror that we are querying. 
   4.155 -
   4.156 -It has to be a URL in the form of a string.
   4.157 -
   4.158 -=cut
   4.159 -
   4.160 -has cpan => (
   4.161 -	is       => 'ro',
   4.162 -	isa      => Str,
   4.163 -	reader   => '_get_cpan',
   4.164 -	required => 1,
   4.165 -);
   4.166 -
   4.167 -
   4.168 -
   4.169 -=head3 bits
   4.170 -
   4.171 -This required parameter defines the 'bitness' of the Perl that we are 
   4.172 -generating the toolchain for. 
   4.173 -
   4.174 -Valid values are 32 or 64.
   4.175 -
   4.176 -=cut
   4.177 -
   4.178 -has bits => (
   4.179 -	is  => 'ro',                       # Integer 32/64
   4.180 -	isa => subtype(
   4.181 -		'Int' => where {
   4.182 -			$_ == 32 or $_ == 64;
   4.183 -		},
   4.184 -		message {
   4.185 -			'Must be a 32 or 64-bit perl';
   4.186 -		},
   4.187 -	),
   4.188 -	required => 1,
   4.189 -);
   4.190 -
   4.191 -
   4.192 -# These attributes are undocumented, and are private to the class.
   4.193 -# They may contain public accessors, and those will be documented.
   4.194 -has _modules => (
   4.195 -	traits   => ['Hash'],
   4.196 -	is       => 'bare',
   4.197 -	isa      => HashRef [ ArrayRef [Str] ],
   4.198 -	builder  => '_build_modules',
   4.199 -	lazy     => 1,
   4.200 -	init_arg => undef,
   4.201 -	handles  => {
   4.202 -		'_modules_exists' => 'exists',
   4.203 -		'_get_modules'    => 'get',
   4.204 -	},
   4.205 -);
   4.206 -
   4.207 -sub _build_modules {
   4.208 -	my $self = shift;
   4.209 -
   4.210 -	my @modules_list = ( qw {
   4.211 -		  ExtUtils::MakeMaker
   4.212 -		  File::Path
   4.213 -		  ExtUtils::Command
   4.214 -		  Win32API::File
   4.215 -		  ExtUtils::Install
   4.216 -		  ExtUtils::Manifest
   4.217 -		  Test::Harness
   4.218 -		  Test::Simple
   4.219 -		  ExtUtils::CBuilder
   4.220 -		  ExtUtils::ParseXS
   4.221 -		  version
   4.222 -		  Scalar::Util
   4.223 -		  Compress::Raw::Zlib
   4.224 -		  Compress::Raw::Bzip2
   4.225 -		  IO::Compress::Base
   4.226 -		  Compress::Bzip2
   4.227 -		  IO::Zlib
   4.228 -		  File::Spec
   4.229 -		  File::Temp
   4.230 -		  Win32::WinError
   4.231 -		  Win32API::Registry
   4.232 -		  Win32::TieRegistry
   4.233 -		  IPC::Run3
   4.234 -		  Probe::Perl
   4.235 -		  Test::Script
   4.236 -		  File::Which
   4.237 -		  File::HomeDir
   4.238 -		  Archive::Zip
   4.239 -		  Package::Constants
   4.240 -		  IO::String
   4.241 -		  Archive::Tar}
   4.242 -	);
   4.243 -
   4.244 -	if ( 32 == $self->bits() ) {
   4.245 -		push @modules_list, 'Compress::unLZMA';
   4.246 -	}
   4.247 -
   4.248 -	push @modules_list, qw{
   4.249 -	  Win32::UTCFileTime
   4.250 -	  CPAN::Meta::YAML
   4.251 -	  JSON::PP
   4.252 -	  Parse::CPAN::Meta
   4.253 -	  YAML
   4.254 -	  Net::FTP
   4.255 -	  Digest::MD5
   4.256 -	  Digest::SHA1
   4.257 -	  Digest::SHA
   4.258 -	  Module::Metadata
   4.259 -	  Perl::OSType
   4.260 -	  Version::Requirements
   4.261 -	  CPAN::Meta
   4.262 -	  Module::Build
   4.263 -	  Term::Cap
   4.264 -	  CPAN
   4.265 -	  Term::ReadKey
   4.266 -	  Term::ReadLine::Perl
   4.267 -	  Text::Glob
   4.268 -	  Data::Dumper
   4.269 -	  Pod::Text
   4.270 -	  URI
   4.271 -	  HTML::Tagset
   4.272 -	  HTML::Parser
   4.273 -	  LWP
   4.274 -	  File::Slurp
   4.275 -	  Capture::Tiny
   4.276 -	};
   4.277 -
   4.278 -=for cmt
   4.279 -list LWP dependencies for a new version
   4.280 -Old version should be used because support of https in new version depeds on Net::SSLeay
   4.281 -which does not work on 64-bit Perl (https://rt.cpan.org/Public/Bug/Display.html?id=53585)
   4.282 -	 qw{
   4.283 -	  Encode::Locale
   4.284 -	  File::Listing
   4.285 -	  HTTP::Date
   4.286 -	  URI
   4.287 -	  HTML::Tagset
   4.288 -	  HTML::Parser
   4.289 -	  LWP::MediaTypes
   4.290 -	  HTTP::Message
   4.291 -	  HTTP::Cookies
   4.292 -	  HTTP::Negotiate
   4.293 -	  Net::HTTP
   4.294 -	  WWW::RobotRules
   4.295 -	  LWP::UserAgent
   4.296 -	};
   4.297 -=cut
   4.298 -
   4.299 -	my %modules = ( '5.010000' => \@modules_list, );
   4.300 -	$modules{'5.010001'} = $modules{'5.010000'};
   4.301 -	$modules{'5.012000'} = $modules{'5.010000'};
   4.302 -	$modules{'5.012001'} = $modules{'5.010000'};
   4.303 -	$modules{'5.012002'} = $modules{'5.010000'};
   4.304 -	$modules{'5.012003'} = $modules{'5.010000'};
   4.305 -	$modules{'5.014000'} = $modules{'5.010000'};
   4.306 -
   4.307 -	return \%modules;
   4.308 -} ## end sub _build_modules
   4.309 -
   4.310 -
   4.311 -
   4.312 -has _corelist_version => (
   4.313 -	traits   => ['Hash'],
   4.314 -	is       => 'bare',
   4.315 -	isa      => HashRef [Str],
   4.316 -	builder  => '_build_corelist_version',
   4.317 -	init_arg => undef,
   4.318 -	lazy     => 1,
   4.319 -	handles  => {
   4.320 -		'_corelist_version_exists' => 'exists',
   4.321 -		'_get_corelist_version'    => 'get',
   4.322 -	},
   4.323 -);
   4.324 -
   4.325 -
   4.326 -
   4.327 -sub _build_corelist_version {
   4.328 -
   4.329 -	my %corelist = (
   4.330 -		'5.010000' => '5.010000',
   4.331 -		'5.010001' => '5.010001',
   4.332 -		'5.012000' => '5.012000',
   4.333 -		'5.012001' => '5.012001',
   4.334 -		'5.012002' => '5.012002',
   4.335 -		'5.012003' => '5.012003',
   4.336 -		'5.014000' => '5.014000',
   4.337 -	);
   4.338 -
   4.339 -	return \%corelist;
   4.340 -} ## end sub _build_corelist_version
   4.341 -
   4.342 -
   4.343 -
   4.344 -has _corelist => (
   4.345 -	traits   => ['Hash'],
   4.346 -	is       => 'bare',
   4.347 -	isa      => HashRef,
   4.348 -	builder  => '_build_corelist',
   4.349 -	init_arg => undef,
   4.350 -	lazy     => 1,
   4.351 -	handles  => {
   4.352 -		'_corelist_exists' => 'exists',
   4.353 -		'_get_corelist'    => 'get',
   4.354 -	},
   4.355 -);
   4.356 -
   4.357 -
   4.358 -
   4.359 -sub _build_corelist {
   4.360 -	my $self = shift;
   4.361 -
   4.362 -	# Confirm we can find the corelist for the Perl version
   4.363 -	my $corelist_version =
   4.364 -	  $self->_get_corelist_version( $self->_get_perl_version() );
   4.365 -	my $corelist = $Module::CoreList::version{$corelist_version}
   4.366 -	  || $Module::CoreList::version{ $corelist_version + 0 };
   4.367 -
   4.368 -	if ( not _HASH($corelist) ) {
   4.369 -		Carp::croak( 'Failed to find module core versions for Perl '
   4.370 -			  . $self->_get_perl_version() );
   4.371 -	}
   4.372 -
   4.373 -	return $corelist;
   4.374 -} ## end sub _build_corelist
   4.375 -
   4.376 -
   4.377 -
   4.378 -=head2 get_dists
   4.379 -
   4.380 -  my @distribution_tarballs = $toolchain->get_dists();
   4.381 -
   4.382 -Gets the distributions that need updated, as a list of 
   4.383 -C<'PAUSEID/Foo-1.23.tar.gz'> strings.
   4.384 -
   4.385 -This routine will only return valid values once C<delegate> has returned.
   4.386 -
   4.387 -=head2 dist_count
   4.388 -
   4.389 -  my $distribution_count = $toolchain->dist_count();
   4.390 -
   4.391 -Gets a count of the number of distributions that need updated.
   4.392 -
   4.393 -This routine will only return valid values once C<delegate> has returned.
   4.394 -
   4.395 -=cut
   4.396 -
   4.397 -
   4.398 -
   4.399 -has _dists => (
   4.400 -	traits   => ['Array'],
   4.401 -	is       => 'bare',
   4.402 -	isa      => ArrayRef [Str],
   4.403 -	default  => sub { return [] },
   4.404 -	init_arg => undef,
   4.405 -	handles  => {
   4.406 -		'_push_dists'  => 'push',
   4.407 -		'get_dists'    => 'elements',
   4.408 -		'_grep_dists'  => 'grep',
   4.409 -		'_empty_dists' => 'clear',
   4.410 -		'dist_count'   => 'count',
   4.411 -	},
   4.412 -);
   4.413 -
   4.414 -
   4.415 -
   4.416 -has _delegated => (
   4.417 -	traits   => ['Bool'],
   4.418 -	is       => 'ro',
   4.419 -	isa      => Bool,
   4.420 -	init_arg => undef,
   4.421 -	default  => 0,
   4.422 -	handles  => { '_delegate' => 'set', },
   4.423 -);
   4.424 -
   4.425 -
   4.426 -
   4.427 -=head2 get_error
   4.428 -
   4.429 -  $toolchain->get_error();
   4.430 -
   4.431 -Retrieves any errors that are returned by 
   4.432 -L<Process::Delegatable|Process::Delegatable>.
   4.433 -
   4.434 -=cut
   4.435 -
   4.436 -# Process::Delegatable sets this, this attribute just
   4.437 -# defines how to get at it.
   4.438 -has errstr => (
   4.439 -	is       => 'bare',
   4.440 -	isa      => Maybe [Str],
   4.441 -	init_arg => undef,
   4.442 -	default  => undef,
   4.443 -	reader   => 'get_error',
   4.444 -);
   4.445 -
   4.446 -
   4.447 -BEGIN {
   4.448 -	@DELEGATE = ();
   4.449 -
   4.450 -	# Automatically handle delegation within the test suite
   4.451 -	if ( $ENV{HARNESS_ACTIVE} ) {
   4.452 -		require Probe::Perl;
   4.453 -		@DELEGATE = ( Probe::Perl->find_perl_interpreter(), '-Mblib', );
   4.454 -	}
   4.455 -}
   4.456 -
   4.457 -
   4.458 -
   4.459 -=head2 delegate
   4.460 -
   4.461 -  $toolchain->delegate() or die $toolchain->get_error();
   4.462 -
   4.463 -Passes the responsibility for the generation of the initial toolchain to 
   4.464 -another perl process.
   4.465 -
   4.466 -See L<Process::Delegatable/delegate|Process::Delegatable-E<gt>delegate>
   4.467 -for more information. 
   4.468 -
   4.469 -=cut
   4.470 -
   4.471 -
   4.472 -
   4.473 -sub delegate {
   4.474 -	my $self = shift;
   4.475 -	if ( not $self->_delegated() ) {
   4.476 -		$self->SUPER::delegate(@DELEGATE);
   4.477 -		$self->_delegate();
   4.478 -	}
   4.479 -	return 1;
   4.480 -}
   4.481 -
   4.482 -
   4.483 -
   4.484 -=head2 prepare
   4.485 -
   4.486 -Loads the latest CPAN index, in preparation for the C<run> method.
   4.487 -
   4.488 -This is not meant to be called by the user, but is called by the C<delegate> method.
   4.489 -
   4.490 -=cut
   4.491 -
   4.492 -
   4.493 -
   4.494 -sub prepare {
   4.495 -	my $self = shift;
   4.496 -
   4.497 -	# Squash all output that CPAN might spew during this process
   4.498 -	my $stdout = IO::Capture::Stdout->new();
   4.499 -	my $stderr = IO::Capture::Stderr->new();
   4.500 -	$stdout->start();
   4.501 -	$stderr->start();
   4.502 -
   4.503 -	# Load the CPAN client
   4.504 -	require CPAN;
   4.505 -	CPAN->import();
   4.506 -
   4.507 -	# Load the latest index
   4.508 -	if (
   4.509 -		eval {
   4.510 -			local $SIG{__WARN__} = sub {1};
   4.511 -			if ( not $CPAN::Config_loaded++ ) {
   4.512 -				CPAN::HandleConfig->load();
   4.513 -			}
   4.514 -			$CPAN::Config->{'urllist'}    = [ $self->_get_cpan() ];
   4.515 -			$CPAN::Config->{'use_sqlite'} = q[0];
   4.516 -			CPAN::Index->reload();
   4.517 -			1;
   4.518 -		} )
   4.519 -	{
   4.520 -		$stdout->stop();
   4.521 -		$stderr->stop();
   4.522 -		return 1;
   4.523 -	} else {
   4.524 -		$stdout->stop();
   4.525 -		$stderr->stop();
   4.526 -		return 0;
   4.527 -	}
   4.528 -} ## end sub prepare
   4.529 -
   4.530 -
   4.531 -
   4.532 -=head2 run
   4.533 -
   4.534 -Queries the CPAN index for what versions of the initial toolchain modules are 
   4.535 -available,
   4.536 -
   4.537 -This is not meant to be called by the user, but is called by the C<delegate> method.
   4.538 -
   4.539 -=cut
   4.540 -
   4.541 -
   4.542 -
   4.543 -sub run {
   4.544 -	my $self = shift;
   4.545 -
   4.546 -	# Squash all output that CPAN might spew during this process
   4.547 -	my $stdout = IO::Capture::Stdout->new();
   4.548 -	my $stderr = IO::Capture::Stderr->new();
   4.549 -	$stdout->start();
   4.550 -	$stderr->start();
   4.551 -
   4.552 -	if ( not $CPAN::Config_loaded++ ) {
   4.553 -		CPAN::HandleConfig->load();
   4.554 -	}
   4.555 -	$CPAN::Config->{'urllist'}    = [ $self->_get_cpan() ];
   4.556 -	$CPAN::Config->{'use_sqlite'} = q[0];
   4.557 -	$stdout->stop();
   4.558 -	$stderr->stop();
   4.559 -
   4.560 -	foreach
   4.561 -	  my $name ( @{ $self->_get_modules( $self->_get_perl_version() ) } )
   4.562 -	{
   4.563 -
   4.564 -		# Shortcut if forced
   4.565 -		if ( $self->_force_exists($name) ) {
   4.566 -			$self->_push_dists( $self->_get_forced_dist($name) );
   4.567 -			next;
   4.568 -		}
   4.569 -
   4.570 -		# Get the CPAN object for the module, covering any output.
   4.571 -		$stdout->start();
   4.572 -		$stderr->start();
   4.573 -		my $module = CPAN::Shell->expand( 'Module', $name );
   4.574 -		$stdout->stop();
   4.575 -		$stderr->stop();
   4.576 -
   4.577 -		if ( not $module ) {
   4.578 -			## no critic (RequireCarping RequireUseOfExceptions)
   4.579 -			die "Failed to find '$name'";
   4.580 -		}
   4.581 -
   4.582 -		# Ignore modules that don't need to be updated
   4.583 -		my $core_version = $self->_get_corelist($name);
   4.584 -		if ( defined $core_version and $core_version =~ /_/ms ) {
   4.585 -
   4.586 -			# Sometimes, the core contains a developer
   4.587 -			# version. For the purposes of this comparison
   4.588 -			# it should be safe to "round down".
   4.589 -			$core_version =~ s{_.+}{}ms;
   4.590 -		}
   4.591 -		my $cpan_version = $module->cpan_version;
   4.592 -		if ( not defined $cpan_version ) {
   4.593 -			next;
   4.594 -		}
   4.595 -		if ( defined $core_version and $core_version >= $cpan_version ) {
   4.596 -			next;
   4.597 -		}
   4.598 -
   4.599 -		# Filter out already seen dists
   4.600 -		my $file = $module->cpan_file;
   4.601 -		$file =~ s{\A [[:upper:]] / [[:upper:]][[:upper:]] /}{}msx;
   4.602 -		$self->_push_dists($file);
   4.603 -	} ## end foreach my $name ( @{ $self...})
   4.604 -
   4.605 -	# Remove duplicates
   4.606 -	my %seen = ();
   4.607 -	my @dists = $self->_grep_dists( sub { !$seen{$_}++ } );
   4.608 -
   4.609 -	$self->_empty_dists();
   4.610 -	$self->_push_dists(@dists);
   4.611 -
   4.612 -	return 1;
   4.613 -} ## end sub run
   4.614 -
   4.615 -__PACKAGE__->meta->make_immutable;
   4.616 -
   4.617 -1;
   4.618 -
   4.619 -__END__
   4.620 -
   4.621 -=pod
   4.622 -
   4.623 -=head1 SUPPORT
   4.624 -
   4.625 -Bugs should be reported via the CPAN bug tracker at
   4.626 -
   4.627 -L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Perl-Dist-WiX>
   4.628 -
   4.629 -For other issues, contact the author.
   4.630 -
   4.631 -=head1 AUTHOR
   4.632 -
   4.633 -Curtis Jewell E<lt>csjewell@cpan.orgE<gt>
   4.634 -
   4.635 -Adam Kennedy E<lt>adamk@cpan.orgE<gt>
   4.636 -
   4.637 -=head1 SEE ALSO
   4.638 -
   4.639 -L<Perl::Dist::WiX|Perl::Dist::WiX>, L<Module::CoreList|Module::CoreList>, 
   4.640 -L<Process|Process>, L<Process::Delegatable|Process::Delegatable>
   4.641 -
   4.642 -=head1 COPYRIGHT AND LICENSE
   4.643 -
   4.644 -Copyright 2009 - 2010 Curtis Jewell.
   4.645 -
   4.646 -Copyright 2007 - 2009 Adam Kennedy.
   4.647 -
   4.648 -This program is free software; you can redistribute
   4.649 -it and/or modify it under the same terms as Perl itself.
   4.650 -
   4.651 -The full text of the license can be found in the
   4.652 -LICENSE file included with this distribution.
   4.653 -
   4.654 -=cut