App-PMUtils
view release on metacpan or search on metacpan
lib/App/PMUtils.pm view on Meta::CPAN
log_trace "Unlinking $path ...";
if (unlink $path) {
$num_success++;
} else {
warn "Can't unlink $path: $!\n";
$num_fail++;
}
}
[$num_success ? 200:500,
$num_success ? "OK" : "All files failed",
undef,
{'cmdline.exit_code' => $num_fail ? 1:0}];
}
$SPEC{pmabstract} = {
v => 1.1,
summary => 'Extract the abstract of locally installed Perl module(s)',
args => {
module => $App::PMUtils::arg_module_multiple,
},
};
sub pmabstract {
require Module::Abstract;
my %args = @_;
my @rows;
for my $mod (@{ $args{module} }) {
push @rows, {
module => $mod,
abstract => Module::Abstract::module_abstract($mod),
};
}
if (@rows > 1) {
return [200, "OK", \@rows, {'table.fields'=>[qw/module abstract/]}];
} else {
return [200, "OK", $rows[0]{abstract}];
}
}
$SPEC{update_this_mod} = {
v => 1.1,
summary => 'Update "this" Perl module',
description => <<'_',
Will use <pm:App::ThisDist>'s `this_mod()` to find out what the current Perl
module is, then run "cpanm -n" against the module. It's a convenient shortcut
for:
% this-mod | cpanm -n
_
args => {
# XXX cpanm options
},
deps => {
prog => 'cpanm',
},
};
sub update_this_mod {
require App::ThisDist;
require IPC::System::Options;
my %args = @_;
my $mod = App::ThisDist::this_mod();
return [412, "Can't determine the current module"] unless defined $mod;
IPC::System::Options::system({log=>1, die=>1}, "cpanm", "-n", $mod);
[200];
}
1;
# ABSTRACT: Command-line utilities related to Perl modules
__END__
=pod
=encoding UTF-8
=head1 NAME
App::PMUtils - Command-line utilities related to Perl modules
=head1 VERSION
This document describes version 0.745 of App::PMUtils (from Perl distribution App-PMUtils), released on 2024-08-30.
=head1 SYNOPSIS
This distribution provides the following command-line utilities related to Perl
modules:
=over
=item 1. L<cpanm-this-mod>
=item 2. L<module-dir>
=item 3. L<pmabstract>
=item 4. L<pmbin>
=item 5. L<pmcat>
=item 6. L<pmchkver>
=item 7. L<pmcore>
=item 8. L<pmcost>
=item 9. L<pmdir>
=item 10. L<pmdoc>
=item 11. L<pmedit>
=item 12. L<pmgrep>
=item 13. L<pmhtml>
( run in 0.466 second using v1.01-cache-2.11-cpan-2398b32b56e )