Net::BitTorrent::Session - .torrent session
new ( { [ARGS] } )
Creates a Net::BitTorrent::Session object. This constructor is called by Net::BitTorrent::add_session() and should not be used directly. new ( ) accepts arguments as a hash, using key-value pairs:
Net::BitTorrent::Session
new ( )
path
Filename of the .torrent file to load.
This is the only required parameter.
base_dir
Base directory used to store the files related to this session. This directory is created if not preexisting.
Default: ./ (Current working directory)
./
block_length
Length of blocks we request from peers of this session. This should not be changed as it can greatly affect performance.
Default: 32768 (2**15)
2**15
Unless stated, all methods return either a true or false value, with true meaning that the operation was a success. When a method states that it returns a value, failure will result in undef or an empty list.
true
false
undef
add_tracker ( URLS )
Add a new Net::BitTorrent::Session::Tracker tier to the session. Accepts a list of URLs.
See also: trackers ( )
append_nodes ( STRING )
Adds a string of compacted nodes to the list of potential peers.
See also: compact_nodes ( ), nodes ( ), Net::BitTorrent::Util::compact( )
as_string ( [ VERBOSE ] )
Returns a 'ready to print' dump of the Net::BitTorrent::Session object's data structure. If called in void context, the structure is printed to STDERR.
STDERR
See also: [id://317520], Net::BitTorrent::as_string()
bitfield ( )
Returns a bitfield representing the pieces that have been successfully downloaded.
block_size ( [NEWVAL] )
Mutator to get and/or set the size used when requesting data from peers. Use with care.
See also: Net::BitTorrent::maximum_buffer_size( ), theory.org (http://tinyurl.com/32k7wu), discussion (http://tinyurl.com/4ekea2)
client ( )
Returns the Net::BitTorrent object related to this session.
close_files ( )
Forces the closure of all related Net::BitTorrent::Session::File objects with open file handles.
Under normal circumstances, this should not be called in clients.
compact_nodes ( )
Returns a list of potential peers as a compacted string.
See also: nodes ( ), Net::BitTorrent::Util::compact( ) Net::BitTorrent::Util::uncompact( )
complete ( )
Boolean value indicating whether or not we have finished downloading all pieces we want.
See also: Net::BitTorrent::Session::Piece
downloaded ( )
Returns the total amount of data downloaded during the current session.
See also: uploaded ( )
files ( )
Returns a list of Net::BitTorrent::Session::File objects representing all files contained in the related .torrent file.
hash_check ( )
Verifies the integrity of all files associated with this session.
This is a blocking method; all processing will stop until this function returns.
See also: Net::BitTorrent::Session::Piece::verify( )
infohash ( )
Returns the 20 byte SHA1 hash used to identify this session internally, with trackers, and with remote peers.
nodes ( )
Returns a list of potential peers.
To receive a compacted list of nodes (to use in a quick resume system, for example), see compact_nodes( ).
peers ( )
Returns a list of all related Net::BitTorrent::Session::Peer objects.
piece_count ( )
Returns the number of Net::BitTorrent::Session::Piece objects related to this session.
piece_size ( )
Returns the piece size defined in the .torrent file.
pieces ( )
Returns a list of Net::BitTorrent::Session::Piece objects.
private ( )
Returns a bool value indicating whether or not this session is allowed to use DHT and other Peer Exchange protocols.
total_size ( )
Returns the total size of all files listed in the .torrent file.
trackers ( )
Returns a list of all Net::BitTorrent::Session::Tracker objects related to the session.
See also: add_tracker ( )
uploaded ( )
Returns the total amount of data uploaded during the current session.
See also: downloaded ( )
Sanko Robinson <sanko@cpan.org> - http://sankorobinson.com/
CPAN ID: SANKO
Copyright 2008 by Sanko Robinson <sanko@cpan.org>
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html or the LICENSE file included with this module.
All POD documentation is covered by the Creative Commons Attribution-Noncommercial-Share Alike 3.0 License (http://creativecommons.org/licenses/by-nc-sa/3.0/us/).
Neither this module nor the AUTHOR is affiliated with BitTorrent, Inc.
To install Net::BitTorrent, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::BitTorrent
CPAN shell
perl -MCPAN -e shell install Net::BitTorrent
For more information on module installation, please visit the detailed CPAN module installation guide.