AnyEvent-Net-Curl-Queued
view release on metacpan or search on metacpan
NAME
AnyEvent::Net::Curl::Queued - Moo wrapper for queued downloads via
Net::Curl & AnyEvent
VERSION
version 0.049
SYNOPSIS
#!/usr/bin/env perl
package CrawlApache;
use feature qw(say);
use strict;
use utf8;
use warnings qw(all);
use HTML::LinkExtor;
use Moo;
extends 'AnyEvent::Net::Curl::Queued::Easy';
after finish => sub {
my ($self, $result) = @_;
say $result . "\t" . $self->final_url;
if (
not $self->has_error
and $self->getinfo('content_type') =~ m{^text/html}
) {
my @links;
HTML::LinkExtor->new(sub {
my ($tag, %links) = @_;
push @links,
grep { $_->scheme eq 'http' and $_->host eq 'localhost' }
values %links;
}, $self->final_url)->parse(${$self->data});
for my $link (@links) {
$self->queue->prepend(sub {
CrawlApache->new($link);
});
}
}
};
1;
package main;
use strict;
use utf8;
use warnings qw(all);
use AnyEvent::Net::Curl::Queued;
my $q = AnyEvent::Net::Curl::Queued->new;
$q->append(sub {
CrawlApache->new('http://localhost/manual/')
});
$q->wait;
WARNING: GONE MOO!
This module isn't using Any::Moose anymore due to the announced
deprecation status of that module. The switch to the Moo is known to
break modules that do extend 'AnyEvent::Net::Curl::Queued::Easy' /
extend 'YADA::Worker'! To keep the compatibility, make sure that you
are using MooseX::NonMoose:
package YourSubclassingModule;
use Moose;
use MooseX::NonMoose;
extends 'AnyEvent::Net::Curl::Queued::Easy';
...
Or MouseX::NonMoose:
package YourSubclassingModule;
use Mouse;
use MouseX::NonMoose;
extends 'AnyEvent::Net::Curl::Queued::Easy';
...
Or the Any::Moose equivalent:
( run in 0.595 second using v1.01-cache-2.11-cpan-a1f116cd669 )