The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::BitTorrent::Session::File - BitTorrent File I/O Class

Constructor

new ( { [ARGS] } )

Creates a Net::BitTorrent::Session::File object. This constructor should not be used directly.

Methods

as_string ( [ VERBOSE ] )

Returns a 'ready to print' dump of the Net::BitTorrent::Session::File object's data structure. If called in void context, the structure is printed to STDERR.

See also: Net::BitTorrent

get_client ( )

Returns the Net::BitTorrent object related to this file.

get_index ( )

Returns the zero based index of this file according to the related Net::BitTorrent::Session object's file list.

get_open_mode ( )

Returns a Fcntl value representing if and how the related file handle is open. Possible values:

    O_RDONLY - Read
    O_WRONLY - Write
    undef    - Closed

See also: Fcntl

get_open_timestamp ( )

Returns when the file was opened.

get_path ( )

Returns the absolute path of the related file.

get_piece_range ( )

Returns the indexes of the first and last Net::BitTorrent::Session::Piece objects covered by this file.

get_pieces ( )

Returns a list of Net::BitTorrent::Session::Piece objects.

get_priority ( )

Returns the download priority of this file.

See also: set_priority ( ), Net::BitTorrent::Session::Piece

set_priority ( NEWVAL )

Sets the download priority of this file.

By default, all files begin with a level two priority with the intent being on a 0 (skip), 1 (low), 2 (normal), 3 (high) priority scale but you may use any scale you want. For example, you could set a file's priority to say... 1,000,000, leave everything else at the default 2 and and be positive we'll work on it first. To avoid downloading this file, set priority to zero.

See also: get_priority ( ) Net::BitTorrent::Session::Piece::priority ( )

NOTE: Setting the priority to zero will tell Net::BitTorrrent not to bother requesting these pieces but the file will still be created on disk if a piece we want overlaps onto this file. Just give me some time to work on an intermediate .piece file and this problem will go away.

get_session ( )

Returns the Net::BitTorrent::Session object related to this file.

get_size ( )

Returns the size of the file represented by this object.

get_touch_timestamp ( )

Returns when the file was last written to.

Author

Sanko Robinson <sanko@cpan.org> - http://sankorobinson.com/

CPAN ID: SANKO

License and Legal

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 5.10 (or higher). See http://www.perl.com/perl/misc/Artistic.html or the LICENSE file included with this distribution.

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.