ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Net-Knuddels/Net/Knuddels.pm
(Generate patch)

Comparing Net-Knuddels/Net/Knuddels.pm (file contents):
Revision 1.11 by root, Thu Jan 13 00:55:00 2005 UTC vs.
Revision 1.12 by root, Thu Jan 13 01:38:44 2005 UTC

198=cut 198=cut
199 199
200sub encode_msg($@) { 200sub encode_msg($@) {
201 my ($self, @args) = @_; 201 my ($self, @args) = @_;
202 my $msg = Net::Knuddels::encode join "\0", @args; 202 my $msg = Net::Knuddels::encode join "\0", @args;
203 my $len = (length $msg) - 1;
204
205 if ($len < 0x80) {
206 (chr $len) . $msg
207 } else {
208 (chr 0x80 | 0x40 | ($len & 0x1f))
209 . (chr +($len >> 5) % 0xff)
210 . (chr +($len >> 13) % 0xff)
211 . $msg
212 }
203} 213}
204 214
205=item $protocol->register ($type => $callback) 215=item $protocol->register ($type => $callback)
206 216
207Register a callback for events of type C<$type>, which is either the name 217Register a callback for events of type C<$type>, which is either the name

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines