… | |
… | |
14 | |
14 | |
15 | AnyEvent::Handle - non-blocking I/O on file handles via AnyEvent |
15 | AnyEvent::Handle - non-blocking I/O on file handles via AnyEvent |
16 | |
16 | |
17 | =cut |
17 | =cut |
18 | |
18 | |
19 | our $VERSION = 4.1; |
19 | our $VERSION = 4.12; |
20 | |
20 | |
21 | =head1 SYNOPSIS |
21 | =head1 SYNOPSIS |
22 | |
22 | |
23 | use AnyEvent; |
23 | use AnyEvent; |
24 | use AnyEvent::Handle; |
24 | use AnyEvent::Handle; |
… | |
… | |
520 | |
520 | |
521 | $self->{json} ? $self->{json}->encode ($ref) |
521 | $self->{json} ? $self->{json}->encode ($ref) |
522 | : JSON::encode_json ($ref) |
522 | : JSON::encode_json ($ref) |
523 | }; |
523 | }; |
524 | |
524 | |
|
|
525 | =back |
|
|
526 | |
525 | =item AnyEvent::Handle::register_write_type type => $coderef->($handle, @args) |
527 | =item AnyEvent::Handle::register_write_type type => $coderef->($handle, @args) |
526 | |
528 | |
527 | This function (not method) lets you add your own types to C<push_write>. |
529 | This function (not method) lets you add your own types to C<push_write>. |
528 | Whenever the given C<type> is used, C<push_write> will invoke the code |
530 | Whenever the given C<type> is used, C<push_write> will invoke the code |
529 | reference with the handle object and the remaining arguments. |
531 | reference with the handle object and the remaining arguments. |
… | |
… | |
531 | The code reference is supposed to return a single octet string that will |
533 | The code reference is supposed to return a single octet string that will |
532 | be appended to the write buffer. |
534 | be appended to the write buffer. |
533 | |
535 | |
534 | Note that this is a function, and all types registered this way will be |
536 | Note that this is a function, and all types registered this way will be |
535 | global, so try to use unique names. |
537 | global, so try to use unique names. |
536 | |
|
|
537 | =back |
|
|
538 | |
538 | |
539 | =cut |
539 | =cut |
540 | |
540 | |
541 | ############################################################################# |
541 | ############################################################################# |
542 | |
542 | |