WWW-Module

 view release on metacpan or  search on metacpan

lib/WWW/Module.pm  view on Meta::CPAN

package WWW::Module;
use strict;
use warnings;

use Carp;
use Data::Dumper;
use File::HomeDir;
use File::Spec;
use CPAN;

use vars qw($VERSION);
$VERSION = '1.00';

my ($MAKE_LOG,$MAKE_ERR,$REQUIRE_ERR);
my $CPAN_HOME;

BEGIN
{
    sub do_conf{
	my $build_dir = File::Spec->catfile($CPAN_HOME,'build');
	my $histfile  = File::Spec->catfile($CPAN_HOME,'histfile');
	my $keep_source_where = File::Spec->catfile($CPAN_HOME,'sources');
	my $conf = {
	    'build_cache' => q[10],
	    'build_dir' => $build_dir,
	    'cache_metadata' => q[1],
	    'commandnumber_in_prompt' => q[1],
	    'cpan_home' => $CPAN_HOME,
	    'ftp' => q[ftp],
	    'ftp_passive' => q[1],
	    'ftp_proxy' => q[],
	    'getcwd' => q[],
	    'gpg' => q[],
	    'gzip' => q[],
	    'histfile' => $histfile,
	    'histsize' => q[100],
	    'http_proxy' => q[],
	    'inactivity_timeout' => q[0],
	    'index_expire' => q[1],
	    'inhibit_startup_message' => q[1],
	    'keep_source_where' => $keep_source_where,
	    'lynx' => q[],
	    'make' => q[],
	    'make_arg' => q[],
	    'make_install_arg' => q[],
	    'make_install_make_command' => q[],
	    'makepl_arg' => q[],
	    'mbuild_arg' => q[],
	    'mbuild_install_arg' => q[],
	    'mbuild_install_build_command' => q[],
	    'mbuildpl_arg' => q[],
	    'ncftp' => q[],
	    'ncftpget' => q[],
	    'no_proxy' => q[],
	    'pager' => q[],
	    'prerequisites_policy' => q[follow],
	    'scan_cache' => q[atstart],
	    'shell' => q[],
	    'tar' => q[],
	    'term_is_latin' => q[],
	    'term_ornaments' => q[],
	    'unzip' => q[],
	    'urllist' => [q[ftp://ftp.mirrorservice.org/sites/ftp.funet.fi/pub/languages/perl/CPAN/],q[ftp://mirrors.ibiblio.org/pub/mirrors/CPAN]],
	    'wget' => q[],
	};
	return $conf;
    }
    
    sub mk_cpan_pm {
	my $user_cpan = File::Spec->catfile(File::HomeDir->my_home,'.cpan','CPAN');
	$CPAN_HOME = File::Spec->catfile(File::Spec->tmpdir(),"cpan-". $>);
	mk_path($CPAN_HOME) or return 0;

	my $cpanpm = File::Spec->catfile($user_cpan,'MyConfig.pm');
	unless(-e $cpanpm){
	    mk_path($user_cpan) or return 0;
	    my $conf = do_conf();
	    
	    if(open(CPANPM,"> ". $cpanpm)){
		print CPANPM Data::Dumper->Dump([$conf],['$CPAN::Config']);
		print CPANPM "1;";
	    } else {
		carp("Couldn't write ". $cpanpm. ": ". $!);
		return 0;
	    }
	    close(CPANPM) or return 0;
	}
	return 1;
    }
    
    sub mk_path{
	my $path = shift;
	unless(-e $path){



( run in 0.477 second using v1.01-cache-2.11-cpan-df04353d9ac )