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

NAME

Net::BitTorrent::Util - BitTorrent Related Utility Functions

Importing From Net::BitTorrent::Util

By default, nothing is exported.

You may import any of the following or use one or more of these tags:

:all

Everything is imported into your namespace.

:bencode

You get the two Bencode-related functions: bencode and bedecode. For more on Bencoding, see the BitTorrent Protocol documentation.

:compact

compact, uncompact

These are tracker response-related functions.

:list

min, max, shuffle, sum

Net::BitTorrent::Util imports these from List::Util.

:log

Net::BitTorrent's log callback uses these:

TRACE
FATAL
ERROR
WARN
INFO
DEBUG

Functions

bencode ( ARGS )

Expects a single value (basic scalar, array reference, or hash reference) and returns a single string.

Bencoding is the BitTorrent protocol's basic serialization and data organization format. The specification supports integers, lists (arrays), dictionaries (hashes), and byte strings.

See Also: Convert::Bencode, Bencode, Convert::Bencode_XS

bdecode ( STRING )

Expects a bencoded string. The return value depends on the type of data contained in the string.

See Also: Convert::Bencode, Bencode, Convert::Bencode_XS

compact ( LIST )

Compacts a list of IPv4:port strings into a single string.

A compact peer is 6 bytes; the first four bytes are the host (in network byte order), the last two bytes are the port (again in network byte order).

uncompact ( STRING )

Inflates a compacted string of peers and returns a list of IPv4:port strings.

Log Levels

FATAL

FATAL errors usually mean something really wrong has taken place. You should restart the application to restore normal operation.

ERROR

ERROR is used for logging general errors that prevent the Net::BitTorrent from functioning as expected.

WARN

WARN is used for logging any unusual situation that is, for the moment, not preventing normal operation.

INFO

INFO level messages include any interesting piece of information that helps to give context to a log, often when things are starting or stopping.

DEBUG

DEBUG level includes anything that you’d like to be in the logs when trying to understand why the application didn’t work as expected.

TRACE

Indicates a level of logging that shows the control flow of the program. Among the things that you’d like to log with a TRACE level are: entry and exit of a method, loop, if statement or other control flow statements.

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 itself.

See [http://www.perl.com/perl/misc/Artistic.html] or the LICENSE file included with this module.

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

1 POD Error

The following errors were encountered while parsing the POD:

Around line 284:

Non-ASCII character seen before =encoding in 'you’d'. Assuming UTF-8