text
stringlengths
0
834k
last if $over_depth == 0;
$over_depth--;
}
elsif (/^=over\b/) {
$over_depth++;
}
print $out $_;
}
print $out ""\n\n=back\n"";
close($out);
}
else {
print ""Sorry, no help for '$cmd'\n"";
}
}
else {
use ActivePerl::PPM;
open(my $out, qq(| $pod2text | $pager));
while (<$fh>) {
s/version \d+\S*/version $ActivePerl::PPM::VERSION/ if /^ppm -/;
print $out $_;
}
close($out);
}
}
sub do_config {
$USAGE = ""config <name> [<val>]"";
usage() unless @ARGV;
if (@ARGV == 1) {
my $key = shift(@ARGV);
$key = '*' if $key eq ""list"";
if ($key =~ /[*?]/) {
my @kv = $ppm->config_list($key);
unless (@kv) {
print ""*** no configuration options matching '$key' found ***\n"";
return;
}
while (@kv) {
my($k, $v) = splice(@kv, 0, 2);
next if $k =~ /^_/ && !$ENV{ACTIVEPERL_PPM_DEBUG}; # private stuff
$v = ""<undef>"" unless defined $v;
printf ""$k = $v\n"";
}
return;
}
my $v = $ppm->config_get($key);
$v = ""<undef>"" unless defined $v;
print ""$v\n"";
}
elsif (@ARGV == 2) {
usage() unless $ARGV[0] =~ /^\w+(\.\w+)*$/;
$ppm->config_save(@ARGV);
}
else {
usage();
}
}
sub do_area {
my $cmd = shift(@ARGV) || ""list"";
AGAIN:
if ($cmd eq ""list"") {
$USAGE = ""area list [--csv [ <sep> ]] [--no-header]"";
my $show_header = 1;
my $csv;
if (@ARGV) {
require Getopt::Long;
Getopt::Long::GetOptions(
'header!' => \$show_header,
'csv:s' => \$csv,
) || usage();
usage() if @ARGV;
}
require ActiveState::Table;
my $tab = ActiveState::Table->new;
$tab->add_field(""name"");
$tab->add_field(""pkgs"");
$tab->add_field(""lib"");
my $default = $ppm->default_install_area;
for my $area ($ppm->areas) {
my $o = $ppm->area($area);
my $name = $area;
$name = ""$name*"" if defined($default) && $name eq $default;
$name = ""($name)"" if $o->readonly;
my $pkgs = $o->packages;
$pkgs = ""n/a"" unless defined $pkgs;
$tab->add_row({
name => $name,
pkgs => $pkgs,
lib => $o->lib,
});
}
if (defined($csv)) {
$csv = "","" if $csv eq """";
print $tab->as_csv(null => """", field_separator => $csv, show_header => $show_header);
}
else {
print $tab->as_box(null => """", show_header => $show_header, show_trailer => 0, align => {pkgs => ""right""}, box_chars => $BOX_CHARS, max_width => terminal_width());
}