Net::BitTorrent::PeerPacket is a Parse/Build Peer Packets from BitTorrent.
# Encode a packet
my $binary_packet = bt_build_packet($key1, $value1, $key2, $value2);
# Decode a packet
my $parsed_packet = bt_parse_packet($binary_data);
Net::BitTorrent::PeerPacket handles parsing and building binary data shared between BitTorrent peers. The module optinally exports a single subroutine for building packets and another for parsing packets, as well as, a constant for each packet type defined by BitTorrent.