use CPANPLUS::Selfupdate;
-use CPANPLUS::Internals::Source;
use CPANPLUS::Internals::Extract;
use CPANPLUS::Internals::Fetch;
use CPANPLUS::Internals::Utils;
use CPANPLUS::Internals::Search;
use CPANPLUS::Internals::Report;
+
+require base;
use Cwd qw[cwd];
+use Module::Load qw[load];
use Params::Check qw[check];
use Locale::Maketext::Simple Class => 'CPANPLUS', Style => 'gettext';
+use Module::Load::Conditional qw[can_load];
use Object::Accessor;
use vars qw[@ISA $VERSION];
@ISA = qw[
- CPANPLUS::Internals::Source
CPANPLUS::Internals::Extract
CPANPLUS::Internals::Fetch
CPANPLUS::Internals::Utils
CPANPLUS::Internals::Report
];
-$VERSION = "0.78";
+$VERSION = "0.87_01";
=pod
Get/set the id
-=item _lib
-
-Get/set the current @INC path -- @INC is reset to this after each
-install.
-
-=item _perl5lib
-
-Get/set the current PERL5LIB environment variable -- $ENV{PERL5LIB}
-is reset to this after each install.
-
=cut
### autogenerate accessors ###
-for my $key ( qw[_conf _id _lib _perl5lib _modules _hosts _methods _status
- _callbacks _selfupdate]
+for my $key ( qw[_conf _id _modules _hosts _methods _status
+ _callbacks _selfupdate _mtree _atree]
) {
no strict 'refs';
*{__PACKAGE__."::$key"} = sub {
=pod
+=back
+
=head1 METHODS
=head2 $internals = CPANPLUS::Internals->_init( _conf => CONFIG_OBJ )
### if extra callbacks are added, don't forget to update the
### 02-internals.t test script with them!
my $callback_map = {
- ### name default value
+ ### name default value
install_prerequisite => 1, # install prereqs when 'ask' is set?
edit_test_report => 0, # edit the prepared test report?
send_test_report => 1, # send the test report?
munge_test_report => sub { return $_[1] },
# filter out unwanted prereqs
filter_prereqs => sub { return $_[1] },
+ # continue if 'make test' fails?
+ proceed_on_test_failure => sub { return 0 },
+ munge_dist_metafile => sub { return $_[1] },
};
my $status = Object::Accessor->new;
_conf => { required => 1, store => \$conf,
allow => IS_CONFOBJ },
_id => { default => '', no_override => 1 },
- _lib => { default => [ @INC ], no_override => 1 },
- _perl5lib => { default => $ENV{'PERL5LIB'}, no_override => 1 },
_authortree => { default => '', no_override => 1 },
_modtree => { default => '', no_override => 1 },
_hosts => { default => {}, no_override => 1 },
if( my $id = $class->_last_id ) {
# make it a singleton.
warn loc(q[%1 currently only supports one %2 object per ] .
- q[running program], 'CPANPLUS', $class);
+ qq[running program\n], 'CPANPLUS', $class);
return $class->_retrieve_id( $id );
}
### initalize it as an empty hashref ###
$args->_status->pending_prereqs( {} );
- ### allow for dirs to be added to @INC at runtime,
- ### rather then compile time
- push @INC, @{$conf->get_conf('lib')};
-
- ### add any possible new dirs ###
- $args->_lib( [@INC] );
-
$conf->_set_build( startdir => cwd() ),
or error( loc("couldn't locate current dir!") );
$id, $args->_id) );
}
+ ### different source engines available now, so set them here
+ { my $store = $conf->get_conf( 'source_engine' )
+ || DEFAULT_SOURCE_ENGINE;
+
+ unless( can_load( modules => { $store => '0.0' }, verbose => 1 ) ) {
+ error( loc( "Could not load source engine '%1'", $store ) );
+
+ if( $store ne DEFAULT_SOURCE_ENGINE ) {
+ msg( loc("Falling back to %1", DEFAULT_SOURCE_ENGINE), 1 );
+
+ load DEFAULT_SOURCE_ENGINE;
+
+ base->import( DEFAULT_SOURCE_ENGINE );
+ } else {
+ return;
+ }
+ } else {
+ base->import( $store );
+ }
+ }
+
return $args;
}
sub _flush {
my $self = shift;
+ my $conf = $self->configure_object;
my %hash = @_;
my $aref;
### set the include paths back to their original ###
if( $what eq 'lib' ) {
- $ENV{PERL5LIB} = $self->_perl5lib || '';
- @INC = @{$self->_lib};
+ $ENV{PERL5LIB} = $conf->_perl5lib || '';
+ @INC = @{$conf->_lib};
### give all modules a new status object -- this is slightly
### costly, but the best way to make sure all statusses are
### forgotten --kane
} elsif ( $what eq 'modules' ) {
for my $modobj ( values %{$self->module_tree} ) {
+
$modobj->_flush;
}
indicating true to edit the test report in an editor and false
to skip it.
+=item proceed_on_test_failure
+
+Is called when 'make test' or 'Build test' fails. Should return
+a boolean indicating whether the install should continue even if
+the test failed.
+
+=item munge_dist_metafile
+
+Is called when the C<CPANPLUS::Dist::*> metafile is created, like
+C<control> for C<CPANPLUS::Dist::Deb>, giving the user a chance to
+programatically alter it. Should return the (munged) text to be
+written to the metafile.
+
=back
=cut
check( $tmpl, \%hash ) or return;
+ my $s = $Config{'path_sep'};
+
+ ### only add if it's not added yet
for my $lib (@$dirs) {
push @INC, $lib unless grep { $_ eq $lib } @INC;
- }
-
- { local $^W; ### it will be complaining if $ENV{PERL5LIB]
- ### is not defined (yet).
- $ENV{'PERL5LIB'} .= join '', map { $Config{'path_sep'} . $_ } @$dirs;
+ #
+ ### it will be complaining if $ENV{PERL5LIB] is not defined (yet).
+ local $^W;
+ $ENV{'PERL5LIB'} .= $s . $lib
+ unless $ENV{'PERL5LIB'} =~ qr|\Q$s$lib\E|;
}
return 1;