… | |
… | |
642 | |
642 | |
643 | 1. Blocking: |
643 | 1. Blocking: |
644 | |
644 | |
645 | my $data = $fcp->client_get ($url); |
645 | my $data = $fcp->client_get ($url); |
646 | |
646 | |
647 | 2. Blocking, but parallelizing: |
647 | 2. Blocking, but running in parallel: |
648 | |
648 | |
649 | my @datas = map $_->result, |
649 | my @datas = map $_->result, |
650 | map $fcp->txn_client_get ($_), |
650 | map $fcp->txn_client_get ($_), |
651 | @urls; |
651 | @urls; |
652 | |
652 | |
653 | Both blocking examples work without the module user having to know |
653 | Both blocking examples work without the module user having to know |
654 | anything about events. |
654 | anything about events. |
655 | |
655 | |
656 | 3a. Event-based in a main program, using any support Event module: |
656 | 3a. Event-based in a main program, using any supported event module: |
657 | |
657 | |
658 | use Event; |
658 | use EV; |
659 | |
659 | |
660 | $fcp->txn_client_get ($url)->cb (sub { |
660 | $fcp->txn_client_get ($url)->cb (sub { |
661 | my $txn = shift; |
661 | my $txn = shift; |
662 | my $data = $txn->result; |
662 | my $data = $txn->result; |
663 | ... |
663 | ... |
664 | }); |
664 | }); |
665 | |
665 | |
666 | Event::loop; |
666 | EV::loop; |
667 | |
667 | |
668 | 3b. The module user could use AnyEvent, too: |
668 | 3b. The module user could use AnyEvent, too: |
669 | |
669 | |
670 | use AnyEvent; |
670 | use AnyEvent; |
671 | |
671 | |
… | |
… | |
678 | |
678 | |
679 | $quit->wait; |
679 | $quit->wait; |
680 | |
680 | |
681 | =head1 SEE ALSO |
681 | =head1 SEE ALSO |
682 | |
682 | |
683 | Event modules: L<Coro::Event>, L<Coro>, L<Event>, L<Glib::Event>, L<Glib>. |
683 | Event modules: L<Coro::EV>, L<EV>, L<EV::Glib>, L<Glib::EV>, |
|
|
684 | L<Coro::Event>, L<Event>, L<Glib::Event>, L<Glib>, L<Coro>, L<Tk>. |
684 | |
685 | |
685 | Implementations: L<AnyEvent::Impl::Coro>, L<AnyEvent::Impl::Event>, L<AnyEvent::Impl::Glib>, L<AnyEvent::Impl::Tk>. |
686 | Implementations: L<AnyEvent::Impl::CoroEV>, L<AnyEvent::Impl::EV>, |
|
|
687 | L<AnyEvent::Impl::CoroEvent>, L<AnyEvent::Impl::Event>, |
|
|
688 | L<AnyEvent::Impl::Glib>, L<AnyEvent::Impl::Tk>, L<AnyEvent::Impl::Perl>. |
686 | |
689 | |
687 | Nontrivial usage example: L<Net::FCP>. |
690 | Nontrivial usage examples: L<Net::FCP>, L<Net::XMPP2>. |
688 | |
691 | |
689 | =head1 |
692 | =head1 |
690 | |
693 | |
691 | =cut |
694 | =cut |
692 | |
695 | |