AnyEvent-BitTorrent
view release on metacpan or search on metacpan
cpanfile
eg/simple_client.pl
lib/AnyEvent/BitTorrent.pm
minil.toml
t/000_tests/001_compile.t
t/000_tests/002_basic.t
t/000_tests/004_global.t
t/000_tests/005_local.t
t/800_utils/Tracker.pm
t/800_utils/Tracker/HTTP.pm
t/900_data/kubuntu-active-13.04-desktop-i386.iso.torrent
META.yml
MANIFEST
t/000_tests/002_basic.t view on Meta::CPAN
#!perl
use AnyEvent;
use lib '../../lib';
use AnyEvent::BitTorrent;
use Net::BitTorrent::Protocol qw[:all];
use Test::More;
use File::Temp;
$|++;
my $torrent = q[t/900_data/kubuntu-active-13.04-desktop-i386.iso.torrent];
my $basedir = File::Temp::tempdir('AB_XXXX', TMPDIR => 1);
chdir '../..' if !-f $torrent;
my $client;
#
$client = AnyEvent::BitTorrent->new(
basedir => $basedir,
path => $torrent,
on_hash_pass => sub {
fail 'Got piece number ' . pop(@_) . ' of ' . $client->piece_count;
},
t/000_tests/002_basic.t view on Meta::CPAN
. pop(@_) . ' of '
. $client->piece_count;
}
);
$client->stop;
#
like $client->peerid, qr[^-AB\d{3}[SU]-.{12}$], 'peerid( )';
is $client->infohash, pack('H*', 'c5588b4606dd1d58e7fb93d8c067e9bf2b50a864'),
'infohash( )';
is $client->size, 1102970880, 'size( )';
is $client->name, 'kubuntu-active-13.04-desktop-i386.iso', 'name( )';
like $client->reserved, qr[^.{8}$], 'reserved( )'; # Weak test
done_testing
t/000_tests/004_global.t view on Meta::CPAN
#!perl
use AnyEvent;
use lib '../../lib';
use AnyEvent::BitTorrent;
use Net::BitTorrent::Protocol qw[:all];
use Test::More;
use File::Temp;
$|++;
my $torrent = q[t/900_data/kubuntu-active-13.04-desktop-i386.iso.torrent];
my $basedir = File::Temp::tempdir('AB_XXXX', TMPDIR => 1);
chdir '../..' if !-f $torrent;
my $cv = AE::cv;
my $client;
my $to = AE::timer(90, 0, sub { diag 'Timeout'; ok 'Timeout'; $cv->send });
#
$client = AnyEvent::BitTorrent->new(
basedir => $basedir,
path => $torrent,
on_hash_pass => sub {
t/000_tests/005_local.t view on Meta::CPAN
#!perl
use strict;
use warnings;
use AnyEvent;
use lib '../../lib';
use AnyEvent::BitTorrent;
#use Net::BitTorrent::Protocol qw[:all];
use Test::More;
use File::Temp;
$|++;
my $torrent = q[t/900_data/kubuntu-active-13.04-desktop-i386.iso.torrent];
chdir '../..' if !-f $torrent;
require t::800_utils::Tracker::HTTP;
my $cv = AE::cv;
my $to = AE::timer(90, 0, sub { diag 'Timeout'; ok 'Timeout'; $cv->send });
#
my $tracker =
t::800_utils::Tracker::HTTP->new(host => '127.0.0.1',
interval => 15
);
( run in 0.492 second using v1.01-cache-2.11-cpan-299005ec8e3 )