… | |
… | |
1030 | If you want to sprinkle loads of logging calls around your code, |
1030 | If you want to sprinkle loads of logging calls around your code, |
1031 | consider creating a logger callback with the "AnyEvent::Log::logger" |
1031 | consider creating a logger callback with the "AnyEvent::Log::logger" |
1032 | function, which can reduce typing, codesize and can reduce the |
1032 | function, which can reduce typing, codesize and can reduce the |
1033 | logging overhead enourmously. |
1033 | logging overhead enourmously. |
1034 | |
1034 | |
|
|
1035 | AnyEvent::fh_block $filehandle |
|
|
1036 | AnyEvent::fh_unblock $filehandle |
|
|
1037 | Sets blocking or non-blocking behaviour for the given filehandle. |
|
|
1038 | |
1035 | WHAT TO DO IN A MODULE |
1039 | WHAT TO DO IN A MODULE |
1036 | As a module author, you should "use AnyEvent" and call AnyEvent methods |
1040 | As a module author, you should "use AnyEvent" and call AnyEvent methods |
1037 | freely, but you should not load a specific event module or rely on it. |
1041 | freely, but you should not load a specific event module or rely on it. |
1038 | |
1042 | |
1039 | Be careful when you create watchers in the module body - AnyEvent will |
1043 | Be careful when you create watchers in the module body - AnyEvent will |
… | |
… | |
1604 | my $txn = shift; |
1608 | my $txn = shift; |
1605 | my $data = $txn->result; |
1609 | my $data = $txn->result; |
1606 | ... |
1610 | ... |
1607 | }); |
1611 | }); |
1608 | |
1612 | |
1609 | EV::loop; |
1613 | EV::run; |
1610 | |
1614 | |
1611 | 3b. The module user could use AnyEvent, too: |
1615 | 3b. The module user could use AnyEvent, too: |
1612 | |
1616 | |
1613 | use AnyEvent; |
1617 | use AnyEvent; |
1614 | |
1618 | |