AnyEvent-Net-Curl-Queued

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
    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 'https://metacpan.org/pod/AnyEvent::Net::Curl::Queued::Easy">AnyEvent::Net::Curl::Queued::Easy';
     
        after finish => sub {
            my ($self, $result) = @_;
    

README  view on Meta::CPAN

45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
                CrawlApache->new($link);
            });
        }
    }
};
 
1;
 
package main;
use strict;
use utf8;
use warnings qw(all);
 
 
my $q = AnyEvent::Net::Curl::Queued->new;
$q->append(sub {
    CrawlApache->new('http://localhost/manual/')
});
$q->wait;

bin/yada  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/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 List::Util qw(shuffle);
use URI;

eg/CrawlApache.pm  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
13
package CrawlApache;
use strict;
use utf8;
use warnings qw(all);
use feature qw(say);
 
use Moo;
use MooX::Types::MooseLike::Base qw(InstanceOf);
 
extends 'https://metacpan.org/pod/YADA::Worker">YADA::Worker';
 
has scrap => (

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

1
2
3
4
5
6
7
8
9
10
11
12

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

1
2
3
4
5
6
7
8
9
10
11
12
package Gauge::Furl;
use strict;
use utf8;
use warnings qw(all);
 
 
use Furl;
 
sub run {
    my ($self) = @_;

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

1
2
3
4
5
6
7
8
9
10
11
12
use strict;
use utf8;
use warnings qw(all);
 
 
 
sub run {
    my ($self) = @_;

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

1
2
3
4
5
6
7
8
9
10
11
12
use strict;
use utf8;
use warnings qw(all);
 
 
 
sub run {
    my ($self) = @_;

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

1
2
3
4
5
6
7
8
9
10
11
12
use strict;
use utf8;
use warnings qw(all);
 
 
 
sub run {
    my ($self) = @_;

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

1
2
3
4
5
6
7
8
9
10
11
12
13
use strict;
use utf8;
use warnings qw(all);
 
 
 
sub run {
    my ($self) = @_;

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

1
2
3
4
5
6
7
8
9
10
11
12
use strict;
use utf8;
use warnings qw(all);
 
 
 
sub run {
    my ($self) = @_;

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

1
2
3
4
5
6
7
8
9
10
11
12
use strict;
use utf8;
use warnings qw(all);
 
 
 
my $loop;
BEGIN { $loop = Mojo::IOLoop->singleton }

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

1
2
3
4
5
6
7
8
9
10
11
12
13
use strict;
use utf8;
use warnings qw(all);
 
 
 
sub run {
    my ($self) = @_;

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package Gauge::Role;
use autodie;
use feature qw(say);
use strict;
use utf8;
use warnings qw(all);
 
use Any::Moose q(::Role);
 
requires qw(run);
 
has fork_manager=> (
    is      => 'ro',

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

1
2
3
4
5
6
7
8
9
10
11
12
use strict;
use utf8;
use warnings qw(all);
 
 
 
sub run {
    my ($self) = @_;

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

1
2
3
4
5
6
7
8
9
10
11
12
package Gauge::YADA;
use strict;
use utf8;
use warnings qw(all);
 
 
use YADA;
 
sub run {
    my ($self) = @_;

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

1
2
3
4
5
6
7
8
9
10
11
12
13
package Gauge::curl;
use strict;
use utf8;
use warnings qw(all);
 
 
sub run {
    my ($self) = @_;
 
    my $curl_queue;
    $self->run_forked(sub {

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

1
2
3
4
5
6
7
8
9
10
11
12
13
package Gauge::lftp;
use strict;
use utf8;
use warnings qw(all);
 
 
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

1
2
3
4
5
6
7
8
9
10
11
12
13
package Gauge::wget;
use strict;
use utf8;
use warnings qw(all);
 
 
sub run {
    my ($self) = @_;
 
    my $wget_queue;
    $self->run_forked(sub {

eg/benchmark.pl  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env perl
use strict;
use utf8;
use warnings qw(all);
 
use Benchmark::Forking qw(cmpthese);
use Class::Load qw(load_class);
use List::Util qw(shuffle);
use POSIX qw(nice);

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

1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/env perl
use strict;
use utf8;
use warnings qw(all);
 
 
use YADA;
 
my $q = YADA->new;
$q->append(sub {
    CrawlApache->new('http://localhost/manual/')

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env perl
 
## no critic (ProhibitMultiplePackages)
 
package MyDownloader;
use strict;
use utf8;
use warnings qw(all);
 
use Moo;
 
extends 'https://metacpan.org/pod/YADA::Worker">YADA::Worker';
 
has '+use_stats'=> (default => sub { 1 });
has '+retry'    => (default => sub { 10 });
 
after init => sub {

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

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
    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 YADA;
 
my $q = YADA->new(
    max     => 8,
    timeout => 30,

eg/simple.pl  view on Meta::CPAN

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env perl
use 5.016;
 
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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# ABSTRACT: the async counterpart to Test::HTTP::Server
 
 
use feature qw(state switch);
use strict;
use utf8;
use warnings qw(all);
 

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

278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
    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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# ABSTRACT: Access Net::Curl::* constants by name
 
 
use strict;
use utf8;
use warnings qw(all);
 
use Carp qw(carp);
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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# ABSTRACT: Moo wrapper for queued downloads via Net::Curl & AnyEvent
 
 
use strict;
use utf8;
use warnings qw(all);
 
use Carp qw(confess);
use Moo;
    AnyOf
    ArrayRef
    Bool
    HashRef

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

249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
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

287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
                CrawlApache->new($link);
            });
        }
    }
};
 
1;
 
package main;
use strict;
use utf8;
use warnings qw(all);
 
 
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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 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 Encode;
use JSON;
use Moo;
    AnyOf

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

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
 
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

144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
    # 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

337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
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

420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# ABSTRACT: Net::Curl::Multi wrapped by Moo
 
 
use strict;
use utf8;
use warnings qw(all);
 
use Carp qw(confess);
use Moo;
    AnyOf
    ArrayRef
    HashRef
    Int

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# ABSTRACT: Connection statistics for AnyEvent::Net::Curl::Queued::Easy
 
 
use strict;
use utf8;
use warnings qw(all);
 
use Carp qw(confess);
use Moo;
use MooX::Types::MooseLike::Base qw(HashRef Num);
 
 
our $VERSION = '0.049'; # VERSION

lib/YADA.pm  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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;
    ArrayRef
    HashRef
    Object
    Str
);



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