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

NAME

Protocol::BitTorrent::Bencode - mixin for bencode/bdecode support

VERSION

version 0.003

SYNOPSIS

 package Some::Package;
 use parent qw(Protocol::BitTorrent::Bencode);

 sub new { bless {}, shift }
 sub method {
        my $self = shift;
        $self->bencode({ data => ... });
 }

DESCRIPTION

A simple mixin that provides "bencode" and "bdecode" methods for use in other classes. The intention is to allow different bencode implementations by changing a single class.

METHODS

bdecode

Decode the given data. May die() if the given bytestring is not valid bencoded data.

bencode

Encode the given data. May die() if the given Perl data structure contains any undefined values.

AUTHOR

Tom Molesworth <cpan@entitymodel.com>

LICENSE

Copyright Tom Molesworth 2011. Licensed under the same terms as Perl itself.