App-NoPAN
view release on metacpan or search on metacpan
lib/App/NoPAN.pm view on Meta::CPAN
use strict;
use warnings;
use base qw(Class::Accessor::Fast);
use Cwd;
use File::Temp qw(tempdir);
use HTML::LinkExtor;
use List::Util qw(first);
use LWP::Simple ();
use Scope::Guard;
use URI::Escape qw/uri_unescape/;
# FIXME find and automatically load NoPAN::Installer::*.pm
require App::NoPAN::Installer::Perl;
require App::NoPAN::Installer::Configure;
require App::NoPAN::Installer::Makefile; # should better be the last
our %Defaults = (
opt_install => 1,
opt_test => undef, # tristate: 0:no, 1:yes, undef:default
);
lib/App/NoPAN.pm view on Meta::CPAN
my ($self, $url) = @_;
my $body = LWP::Simple::get($url)
or die "failed to fetch URL:$url";
return grep {
$_ !~ m{^(\.{1,2}|)$},
} map {
substr($_, 0, length $url) eq $url ? (substr $_, length $url) : ()
} map {
my ($tag, %attr) = @$_;
$tag eq 'a' && $attr{href} ? (uri_unescape $attr{href}) : ();
} do {
my $lx = HTML::LinkExtor->new(undef, $url);
$lx->parse($body);
$lx->links;
};
}
sub register {
my ($klass, $installer) = @_;
push @Installers, $installer;
( run in 0.392 second using v1.01-cache-2.11-cpan-c21f80fb71c )