…brings BitTorrent to Perl! It works pretty much everywhere, depends only on core modules, and it's easy to use.

Net::BitTorrent development is hosted by GitHub. The official support channel is, #net-bittorrent on IRC but there's also a mailing list where users can seek assistance and an issue tracker for bug reports. To stay up to date with development, follow the project on Twitter or skim my blog-like thing.

Several example scripts come with the distribution on CPAN but since you asked nicely, here's a quick demonstration of that easy I mentioned earlier.

  1. #!perl -w
  3. # - A very brief example
  5. use Net::BitTorrent;
  6. my $client = Net::BitTorrent->new( );
  8. $client->on_event(
  9. q[piece_hash_pass],
  10. sub hash_pass {
  11. my ($self, $args) = @_;
  12. printf(qq[pass: piece number %04d of %s\n],
  13. $args->{q[Index]}, $args->{q[Torrent]}->infohash);
  14. }
  15. );
  17. my $torrent = $client->add_torrent({Path => q[]})
  18. or die q[Cannot load .torrent];
  20. $torrent->hashcheck; # Verify any existing data
  22. $client->do_one_loop( ) while 1;

If you find Net::BitTorrent useful, feel free to support the project with donations; code is welcome from developers and cash is welcome from everyone.

Fork me on GitHub