R. Kyle Murphy > Net-BitTorrent-File > Net::BitTorrent::File

Download:
Net-BitTorrent-File-1.02-fix.tar.gz

Dependencies

Annotate this POD (3)

CPAN RT

Open  1
View/Report Bugs
Module Version: 1.02   Source  

NAME ^

Net::BitTorrent::File - Object for manipulating .torrent files

SYNOPSIS ^

  use Net::BitTorrent::File

  # Empty N::BT::File object, ready to be filled with info
  my $torrent = new Net::BitTorrent::File;

  # Or, create one from a existing .torrent file
  my $fromfile = new Net::BitTorrent::File ('somefile.torrent');

  $torrent->name('Some_File_to_distribute.tar.gz');
  $torrent->announce('http://address.of.tracker:6695');
  # etc.

  print $torrent->name()."\n";
  # would print "Some_File_to_distribute.tar.gz" in this case.

DESCRIPTION ^

This module handles loading and saveing of .torrent files as well as providing a convenient way to store torrent file info in memory. Most users of the module will most likely just call the new method with the name of a existing torrent file and use the data from that.

USAGE ^

The same method is used for setting and retrieving a value, and the methods have the same name as the key in the torrent file, such as name(), and announce(). If the method is called with no arguments or a undefined value, then the current value is returned, otherwise its set to the value passed in.

There are two methods for generating info based on torrent data, but not stored within the torrent itself. These are gen_info_hash() and gen_pieces_array(). You can use the methods info_hash() and pieces_array() to return the calculated values after calling there respective gen_X() methods.

info_hash() returns the SHA1 hash of the info portion of the torrent which is used in the bittorrent protocol.

pieces_array() returns a array ref of the pieces field of the torrent split into the individual 20 byte SHA1 hashes. For further details on what exactly these are used for, see the docs for the bittorrent protocol mentioned in the SEE ALSO section.

Methods

BUGS ^

None that I know of yet.

SUPPORT ^

Any bugs/suggestions/problems, feel free to send me a e-mail, I'm usually glad to help, and enjoy hearing from people using my code. My e-mail is listed in the AUTHOR section.

AUTHOR ^

        R. Kyle Murphy
        orclev@rejectedmaterial.com

COPYRIGHT ^

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

SEE ALSO ^

Convert::Bencode, http://bitconjurer.org/BitTorrent/protocol.html

syntax highlighting: