App-DuckPAN
view release on metacpan or search on metacpan
lib/App/DuckPAN/Perl.pm view on Meta::CPAN
package App::DuckPAN::Perl;
our $AUTHORITY = 'cpan:DDG';
# ABSTRACT: Perl related functionality for duckpan
$App::DuckPAN::Perl::VERSION = '1021';
use Moo;
with 'App::DuckPAN::HasApp';
use Config::INI;
use Dist::Zilla::Util;
use Path::Tiny;
use Config::INI::Reader;
use Config::INI::Writer;
use Data::Dumper;
use LWP::UserAgent;
use List::MoreUtils qw/ uniq /;
use List::Util qw/ first /;
use File::Temp qw/ :POSIX /;
use version;
use Parse::CPAN::Packages::Fast;
use Class::Load ':all';
no warnings 'uninitialized';
sub get_local_version {
my ($self, $module) = @_;
require Module::Data;
my $v;
{
local $@;
# ensure $module is installed by trying to load (require) it
eval {
my $m = Module::Data->new($module);
$m->require;
$v = $m->version;
1;
} or return;
};
# $module (e.g. DuckPAN, DDG) has loaded, but no $VERSION exists
# This means we're not working with code that was built by DZIL
#
# Example:
# > ./bin/duckpan -I/lib/ -I../duckduckgo/lib server
unless (defined $v) {
if ($module eq 'App::DuckPAN' || $module eq 'DDG'){
# When executing code in-place, $VERSION will not be defined.
# Only the installed package will have a defined version
# thanks to Dist::Zilla::Plugin::PkgVersion
return $self->app->dev_version;
}
return;
}
return version->parse($v) unless ref $v;
return $v;
}
sub cpanminus_install_error {
shift->app->emit_and_exit(1,
"Failure on installation of modules!",
"There are several possible explanations and fixes for this error:",
"1. The download from CPAN was unsuccessful - Please restart this installer.",
"2. Some other error occured - Please read the `build.log` mentioned in the errors and see if you can fix the problem yourself.",
"If you are unable to solve the problem, please let us know by making a GitHub Issue in the DuckPAN Repo:",
"https://github.com/duckduckgo/p5-app-duckpan/issues",
"Make sure to attach the `build.log` file if it exists. Otherwise, copy/paste the output you see."
);
}
sub duckpan_install {
my ($self, @modules) = @_;
my $mirror = $self->app->duckpan;
my ($reinstall, $latest);
( run in 1.890 second using v1.01-cache-2.11-cpan-99c4e6809bf )