Net::BitTorrent::Session::File - File class


new ( { [ARGS] } )

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


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: [id://317520], Net::BitTorrent::as_string()

client ( )

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

index ( )

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

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

open_timestamp ( )

Returns when the file was opened.

path ( )

Returns the absolute path of the related file.

piece_range ( )

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

pieces ( )

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

priority ( [NEWVAL] )

Mutator to set/get 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: 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.

session ( )

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

size ( )

Returns the size of the file represented by this object.

touch_timestamp ( )

Returns when the file was last written to.


Sanko Robinson <> -



Copyright 2008 by Sanko Robinson <>

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See or the LICENSE file included with this module.

All POD documentation is covered by the Creative Commons Attribution-Noncommercial-Share Alike 3.0 License (

Neither this module nor the AUTHOR is affiliated with BitTorrent, Inc.