AnyEvent-Net-Curl-Queued

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN


    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) = @_;
    

README  view on Meta::CPAN

                        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;

bin/yada  view on Meta::CPAN

#!/usr/bin/env perl
# ABSTRACT: Yet Another Download Accelerator CLI wrapper
# PODNAME: yada
use strict;
use utf8;
use warnings qw(all);

use Config;
use Fcntl;
use File::Copy;
use Getopt::Long;
use IO::Handle;
use List::Util qw(shuffle);
use Pod::Usage;
use URI;

eg/CrawlApache.pm  view on Meta::CPAN

package CrawlApache;
use strict;
use utf8;
use warnings qw(all);
use feature qw(say);

use Moo;
use MooX::Types::MooseLike::Base qw(InstanceOf);
use Web::Scraper::LibXML;

extends 'YADA::Worker';

has scrap => (

eg/Gauge/AnyEvent_Curl_Multi.pm  view on Meta::CPAN

package Gauge::AnyEvent_Curl_Multi;
use strict;
use utf8;
use warnings qw(all);

use Any::Moose;
with qw(Gauge::Role);

use AnyEvent;
use AnyEvent::Curl::Multi;
use HTTP::Request::Common qw(GET);
use WWW::Curl::Easy;

eg/Gauge/Furl.pm  view on Meta::CPAN

package Gauge::Furl;
use strict;
use utf8;
use warnings qw(all);

use Any::Moose;
with qw(Gauge::Role);

use Furl;

sub run {
    my ($self) = @_;

eg/Gauge/HTTP_Lite.pm  view on Meta::CPAN

package Gauge::HTTP_Lite;
use strict;
use utf8;
use warnings qw(all);

use Any::Moose;
with qw(Gauge::Role);

use HTTP::Lite;

sub run {
    my ($self) = @_;

eg/Gauge/HTTP_Tiny.pm  view on Meta::CPAN

package Gauge::HTTP_Tiny;
use strict;
use utf8;
use warnings qw(all);

use Any::Moose;
with qw(Gauge::Role);

use HTTP::Tiny;

sub run {
    my ($self) = @_;

eg/Gauge/LWP_Curl.pm  view on Meta::CPAN

package Gauge::LWP_Curl;
use strict;
use utf8;
use warnings qw(all);

use Any::Moose;
with qw(Gauge::Role);

use LWP::Curl;

sub run {
    my ($self) = @_;

eg/Gauge/LWP_Protocol_Net_Curl.pm  view on Meta::CPAN

package Gauge::LWP_Protocol_Net_Curl;
use strict;
use utf8;
use warnings qw(all);

use Any::Moose;
with qw(Gauge::Role);

use LWP::Protocol::Net::Curl;
use LWP::UserAgent;

sub run {
    my ($self) = @_;

eg/Gauge/LWP_UserAgent.pm  view on Meta::CPAN

package Gauge::LWP_UserAgent;
use strict;
use utf8;
use warnings qw(all);

use Any::Moose;
with qw(Gauge::Role);

use LWP::UserAgent;

sub run {
    my ($self) = @_;

eg/Gauge/Mojo_UserAgent.pm  view on Meta::CPAN

package Gauge::Mojo_UserAgent;
use strict;
use utf8;
use warnings qw(all);

use Any::Moose;
with qw(Gauge::Role);

use Mojolicious;

my $loop;
BEGIN { $loop = Mojo::IOLoop->singleton }

eg/Gauge/Parallel_Downloader.pm  view on Meta::CPAN

package Gauge::Parallel_Downloader;
use strict;
use utf8;
use warnings qw(all);

use Any::Moose;
with qw(Gauge::Role);

use HTTP::Request::Common qw(GET);
use Parallel::Downloader;

sub run {
    my ($self) = @_;

eg/Gauge/Role.pm  view on Meta::CPAN

package Gauge::Role;
use autodie;
use feature qw(say);
use strict;
use utf8;
use warnings qw(all);

use Any::Moose q(::Role);
use Parallel::ForkManager;
use File::Temp;

requires qw(run);

has fork_manager=> (
    is      => 'ro',

eg/Gauge/WWW_Mechanize.pm  view on Meta::CPAN

package Gauge::WWW_Mechanize;
use strict;
use utf8;
use warnings qw(all);

use Any::Moose;
with qw(Gauge::Role);

use WWW::Mechanize;

sub run {
    my ($self) = @_;

eg/Gauge/YADA.pm  view on Meta::CPAN

package Gauge::YADA;
use strict;
use utf8;
use warnings qw(all);

use Any::Moose;
with qw(Gauge::Role);

use YADA;

sub run {
    my ($self) = @_;

eg/Gauge/curl.pm  view on Meta::CPAN

package Gauge::curl;
use strict;
use utf8;
use warnings qw(all);

use Any::Moose;
with qw(Gauge::Role);

sub run {
    my ($self) = @_;

    my $curl_queue;
    $self->run_forked(sub {

eg/Gauge/lftp.pm  view on Meta::CPAN

package Gauge::lftp;
use strict;
use utf8;
use warnings qw(all);

use Any::Moose;
with qw(Gauge::Role);

sub run {
    my ($self) = @_;

    my $lftp_queue = File::Temp->new;
    say $lftp_queue "set cmd:queue-parallel " . $self->parallel;

eg/Gauge/wget.pm  view on Meta::CPAN

package Gauge::wget;
use strict;
use utf8;
use warnings qw(all);

use Any::Moose;
with qw(Gauge::Role);

sub run {
    my ($self) = @_;

    my $wget_queue;
    $self->run_forked(sub {

eg/benchmark.pl  view on Meta::CPAN

#!/usr/bin/env perl
use strict;
use utf8;
use warnings qw(all);

use Benchmark::Forking qw(cmpthese);
use Class::Load qw(load_class);
use File::Basename;
use File::Slurp;
use Getopt::Long;
use List::Util qw(shuffle);
use POSIX qw(nice);

eg/crawl-apache.pl  view on Meta::CPAN

#!/usr/bin/env perl
use strict;
use utf8;
use warnings qw(all);

use Data::Printer;

use YADA;
use CrawlApache;

my $q = YADA->new;
$q->append(sub {
    CrawlApache->new('http://localhost/manual/')

eg/fetch-urls.pl  view on Meta::CPAN

#!/usr/bin/env perl

## no critic (ProhibitMultiplePackages)

package MyDownloader;
use strict;
use utf8;
use warnings qw(all);

use Moo;

extends 'YADA::Worker';

has '+use_stats'=> (default => sub { 1 });
has '+retry'    => (default => sub { 10 });

after init => sub {

eg/fetch-urls.pl  view on Meta::CPAN

    my $self = shift;

    return 1 if $self->$orig(@_);
    return 1 if $self->getinfo('response_code') =~ m{^5[0-9]{2}$}x;
};

1;

package main;
use strict;
use utf8;
use warnings qw(all);

use Carp;
use Data::Printer;

use YADA;

my $q = YADA->new(
    max     => 8,
    timeout => 30,

eg/simple.pl  view on Meta::CPAN

#!/usr/bin/env perl
use feature qw(say);
use strict;
use utf8;
use warnings qw(all);

use YADA;

YADA->new->append(
    [qw[
        http://www.cpan.org/modules/by-category/02_Language_Extensions/
        http://www.cpan.org/modules/by-category/02_Perl_Core_Modules/
        http://www.cpan.org/modules/by-category/03_Development_Support/
        http://www.cpan.org/modules/by-category/04_Operating_System_Interfaces/

eg/yada-crawler.pl  view on Meta::CPAN

#!/usr/bin/env perl
use 5.016;
use common::sense;
use utf8::all;

use Web::Scraper::LibXML;
use YADA;

YADA->new(common_opts => { encoding => '' }, http_response => 1, max => 4)
->append([qw[http://localhost/manual/]] => sub {
    my ($self) = @_;
    return if not $self->response->is_success
        or not $self->response->content_is_html;
    my $doc = scraper {

inc/Test/HTTP/AnyEvent/Server.pm  view on Meta::CPAN

package Test::HTTP::AnyEvent::Server;
# ABSTRACT: the async counterpart to Test::HTTP::Server


use feature qw(state switch);
use strict;
use utf8;
use warnings qw(all);

use AnyEvent;
use AnyEvent::Handle;
use AnyEvent::Log;
use AnyEvent::Socket;
use AnyEvent::Util;
use HTTP::Headers;
use HTTP::Request;
use HTTP::Response;

inc/Test/HTTP/AnyEvent/Server.pm  view on Meta::CPAN

    return;
}


1;

__END__

=pod

=encoding utf8

=head1 NAME

Test::HTTP::AnyEvent::Server - the async counterpart to Test::HTTP::Server

=head1 VERSION

version 0.007

=head1 SYNOPSIS

lib/AnyEvent/Net/Curl/Const.pm  view on Meta::CPAN

package AnyEvent::Net::Curl::Const;
# ABSTRACT: Access Net::Curl::* constants by name


use strict;
use utf8;
use warnings qw(all);

use Carp qw(carp);
use Net::Curl::Easy;
use Scalar::Util qw(looks_like_number);

our $VERSION = '0.049'; # VERSION


my (%const_info, %const_opt);

lib/AnyEvent/Net/Curl/Queued.pm  view on Meta::CPAN

package AnyEvent::Net::Curl::Queued;
# ABSTRACT: Moo wrapper for queued downloads via Net::Curl & AnyEvent


use strict;
use utf8;
use warnings qw(all);

use AnyEvent;
use Carp qw(confess);
use Moo;
use MooX::Types::MooseLike::Base qw(
    AnyOf
    ArrayRef
    Bool
    HashRef

lib/AnyEvent/Net/Curl/Queued.pm  view on Meta::CPAN


version 0.049

=head1 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) = @_;

lib/AnyEvent/Net/Curl/Queued.pm  view on Meta::CPAN

                    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;

lib/AnyEvent/Net/Curl/Queued/Easy.pm  view on Meta::CPAN

package AnyEvent::Net::Curl::Queued::Easy;
# ABSTRACT: Net::Curl::Easy wrapped by Moo


use feature qw(switch);
use strict;
use utf8;
use warnings qw(all);

use Carp qw(carp confess);
use Digest::SHA;
use Encode;
use HTTP::Response;
use JSON;
use Moo;
use MooX::Types::MooseLike::Base qw(
    AnyOf

lib/AnyEvent/Net/Curl/Queued/Easy.pm  view on Meta::CPAN

use AnyEvent::Net::Curl::Const;
use AnyEvent::Net::Curl::Queued::Stats;

no if ($] >= 5.017010), warnings => q(experimental);

our $VERSION = '0.049'; # VERSION

has json        => (
    is          => 'ro',
    isa         => InstanceOf['JSON'],
    default     => sub { JSON->new->utf8->allow_blessed->convert_blessed },
    lazy        => 1,
);


has curl_result => (is => 'ro', isa => Object, writer => 'set_curl_result');


has data        => (is => 'ro', isa => ScalarRef, writer => 'set_data');


lib/AnyEvent/Net/Curl/Queued/Easy.pm  view on Meta::CPAN

    # return the signature
    return $digest;
}


sub sign {
    my ($self, $str) = @_;

    # add entropy to the signature
    ## no critic (ProtectPrivateSubs)
    Encode::_utf8_off($str);
    return $self->sha->add($str);
}


sub init {
    my ($self) = @_;

    # buffers
    my $data = '';
    $self->set_data(\$data);

lib/AnyEvent/Net/Curl/Queued/Easy.pm  view on Meta::CPAN

sub _setopt_postfields {
    my ($self, $val) = @_;

    my $is_json = 0;
    if ('HASH' eq ref $val) {
        ++$is_json;
        $val = $self->json->encode($val);
    } else {
        # some DWIMmery here!
        # application/x-www-form-urlencoded is supposed to have a 7-bit encoding
        $val = encode_utf8($val)
            if utf8::is_utf8($val);

        my $obj;
        ++$is_json if 'HASH' eq ref($obj = eval { $self->json->decode($val) });
    }

    return ($self->set_post_content($val), $is_json);
}

sub _setopt_encoding {
    my ($self, $val) = @_;

lib/AnyEvent/Net/Curl/Queued/Easy.pm  view on Meta::CPAN

AnyEvent::Net::Curl::Queued::Easy - Net::Curl::Easy wrapped by Moo

=head1 VERSION

version 0.049

=head1 SYNOPSIS

    package MyIEDownloader;
    use strict;
    use utf8;
    use warnings qw(all);

    use Moo;
    use Net::Curl::Easy qw(/^CURLOPT_/);

    extends 'AnyEvent::Net::Curl::Queued::Easy';

    after init => sub {
        my ($self) = @_;

lib/AnyEvent/Net/Curl/Queued/Multi.pm  view on Meta::CPAN

package AnyEvent::Net::Curl::Queued::Multi;
# ABSTRACT: Net::Curl::Multi wrapped by Moo


use strict;
use utf8;
use warnings qw(all);

use AnyEvent;
use Carp qw(confess);
use Moo;
use MooX::Types::MooseLike::Base qw(
    AnyOf
    ArrayRef
    HashRef
    Int

lib/AnyEvent/Net/Curl/Queued/Stats.pm  view on Meta::CPAN

package AnyEvent::Net::Curl::Queued::Stats;
# ABSTRACT: Connection statistics for AnyEvent::Net::Curl::Queued::Easy


use strict;
use utf8;
use warnings qw(all);

use AnyEvent;
use Carp qw(confess);
use Moo;
use MooX::Types::MooseLike::Base qw(HashRef Num);

use AnyEvent::Net::Curl::Const;

our $VERSION = '0.049'; # VERSION

lib/YADA.pm  view on Meta::CPAN

package YADA;
# ABSTRACT: "Yet Another Download Accelerator": alias for AnyEvent::Net::Curl::Queued


use feature qw(switch);
use strict;
use utf8;
use warnings qw(all);

use Digest::SHA qw(sha256_base64);
use Moo;
use MooX::Types::MooseLike::Base qw(
    ArrayRef
    HashRef
    Object
    Str
);



( run in 0.776 second using v1.01-cache-2.11-cpan-49f99fa48dc )