cpanp-local


#!/usr/bin/perl

use strict;
use warnings;

my $local = {
				path   => '/mnt/shared/CPAN',
				scheme => 'file',
				host   => '',
			};

use vars '$VERSION';

use CPANPLUS;
use CPANPLUS::Shell qw[Default];
use CPANPLUS::Backend;

$VERSION = CPANPLUS->VERSION;

# my $cb = new CPANPLUS::Backend;
my $shell = CPANPLUS::Shell->new;
my $conf = $shell->backend->configure_object;

# my $hosts = $conf->get_conf('hosts');
# unshift @$hosts, $local;
my $hosts = [ $local ];
$conf->set_conf('hosts' => $hosts);

### if we're given a command, run it; otherwise, open a shell.
if (@ARGV) {
    ### take the command line arguments as a command
    my $input = "@ARGV";
    ### if they said "--help", fix it up to work.
    $input = 'h' if $input =~ /^\s*--?h(?:elp)?\s*$/i;
    ### strip the leading dash
    $input =~ s/^\s*-//;
    ### pass the command line to the shell
    $shell->dispatch_on_input(input => $input, noninteractive => 1);
} else {
    ### open a shell for the user
    $shell->shell();
}