Protocol::BitTorrent::Message - base class for BitTorrent messages
version 0.004
use Protocol::BitTorrent::Message; $sock->read(my $buf, 4096); while(my $msg = Protocol::BitTorrent::Message->new_from_buffer(\$buf)) { $self->handle_message($msg); }
See Protocol::BitTorrent and Protocol::BitTorrent::Metainfo for usage information.
Base method for instantiation, returns a blessed object.
Returns an instance of a Protocol::BitTorrent::Message subclass, or undef if insufficient data has been provided in the buffer.
Takes a single scalar ref as parameter - this should be a reference to the scalar buffer containing data to be parsed. Removes packet data from this buffer if parsing was successful.
Returns the class name for the given type (as taken from a BitTorrent network packet).
Returns a stringified version of this message.
Returns the type for this message - stub method for base class, should be overridden in subclasses.
Tom Molesworth <cpan@entitymodel.com>
Copyright Tom Molesworth 2011. Licensed under the same terms as Perl itself.
To install Protocol::BitTorrent, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Protocol::BitTorrent
CPAN shell
perl -MCPAN -e shell install Protocol::BitTorrent
For more information on module installation, please visit the detailed CPAN module installation guide.