[Bps-public-commit] r10216 - bpsbuilder/BPB/lib/BPB/Source
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Sun Dec 30 23:58:14 EST 2007
Author: sunnavy
Date: Sun Dec 30 23:58:14 2007
New Revision: 10216
Modified:
bpsbuilder/BPB/lib/BPB/Source/CPAN.pm
Log:
try to use CPAN::Config, but if it doesn't exist, just warn it
Modified: bpsbuilder/BPB/lib/BPB/Source/CPAN.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Source/CPAN.pm (original)
+++ bpsbuilder/BPB/lib/BPB/Source/CPAN.pm Sun Dec 30 23:58:14 2007
@@ -10,15 +10,19 @@
use File::Temp qw/tempdir/;
use File::Spec;
use File::Slurp;
+use UNIVERSAL::require;
use base qw/BPB::Source::Base/;
my $cpan_dir = tempdir( CLEANUP => 0 );
unshift @INC, $cpan_dir;
+
sub new {
my $class = shift;
my $self = $class->SUPER::new(@_);
+ CPAN::Config->use or warn 'CPAN::Config not found';
+
mkdir File::Spec->catfile( $cpan_dir, 'CPAN' );
my $config_file = File::Spec->catfile( $cpan_dir, 'CPAN', 'MyConfig.pm' );
@@ -29,8 +33,7 @@
File::Spec->catfile( $cpan_dir, 'histfile' );
$CPAN::Config->{keep_source_where} =
File::Spec->catfile( $cpan_dir, 'sources' );
- $CPAN::Config->{prefs_dir}
- = File::Spec->catfile( $cpan_dir, 'prefs' );
+ $CPAN::Config->{prefs_dir} = File::Spec->catfile( $cpan_dir, 'prefs' );
$CPAN::Config->{prerequisites_policy} = 'follow';
write_file( $config_file,
Data::Dumper->Dump( [$CPAN::Config], ['$CPAN::Config'] ) );
@@ -44,7 +47,6 @@
=cut
-
sub run {
my $self = shift;
$self->_run;
@@ -79,7 +81,6 @@
);
}
-
1;
__END__
More information about the Bps-public-commit
mailing list