ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/lib/AnyEvent.pm
(Generate patch)

Comparing AnyEvent/lib/AnyEvent.pm (file contents):
Revision 1.132 by root, Sun May 25 01:05:27 2008 UTC vs.
Revision 1.134 by root, Sun May 25 04:44:04 2008 UTC

612 612
613If it doesn't care, it can just "use AnyEvent" and use it itself, or not 613If it doesn't care, it can just "use AnyEvent" and use it itself, or not
614do anything special (it does not need to be event-based) and let AnyEvent 614do anything special (it does not need to be event-based) and let AnyEvent
615decide which implementation to chose if some module relies on it. 615decide which implementation to chose if some module relies on it.
616 616
617If the main program relies on a specific event model. For example, in 617If the main program relies on a specific event model - for example, in
618Gtk2 programs you have to rely on the Glib module. You should load the 618Gtk2 programs you have to rely on the Glib module - you should load the
619event module before loading AnyEvent or any module that uses it: generally 619event module before loading AnyEvent or any module that uses it: generally
620speaking, you should load it as early as possible. The reason is that 620speaking, you should load it as early as possible. The reason is that
621modules might create watchers when they are loaded, and AnyEvent will 621modules might create watchers when they are loaded, and AnyEvent will
622decide on the event model to use as soon as it creates watchers, and it 622decide on the event model to use as soon as it creates watchers, and it
623might chose the wrong one unless you load the correct one yourself. 623might chose the wrong one unless you load the correct one yourself.
624 624
625You can chose to use a rather inefficient pure-perl implementation by 625You can chose to use a pure-perl implementation by loading the
626loading the C<AnyEvent::Impl::Perl> module, which gives you similar 626C<AnyEvent::Impl::Perl> module, which gives you similar behaviour
627behaviour everywhere, but letting AnyEvent chose is generally better. 627everywhere, but letting AnyEvent chose the model is generally better.
628
629=head2 MAINLOOP EMULATION
630
631Sometimes (often for short test scripts, or even standalone programs who
632only want to use AnyEvent), you do not want to run a specific event loop.
633
634In that case, you can use a condition variable like this:
635
636 AnyEvent->condvar->recv;
637
638This has the effect of entering the event loop and looping forever.
639
640Note that usually your program has some exit condition, in which case
641it is better to use the "traditional" approach of storing a condition
642variable somewhere, waiting for it, and sending it when the program should
643exit cleanly.
644
628 645
629=head1 OTHER MODULES 646=head1 OTHER MODULES
630 647
631The following is a non-exhaustive list of additional modules that use 648The following is a non-exhaustive list of additional modules that use
632AnyEvent and can therefore be mixed easily with other AnyEvent modules 649AnyEvent and can therefore be mixed easily with other AnyEvent modules
648 665
649Provides various utility functions for (internet protocol) sockets, 666Provides various utility functions for (internet protocol) sockets,
650addresses and name resolution. Also functions to create non-blocking tcp 667addresses and name resolution. Also functions to create non-blocking tcp
651connections or tcp servers, with IPv6 and SRV record support and more. 668connections or tcp servers, with IPv6 and SRV record support and more.
652 669
670=item L<AnyEvent::DNS>
671
672Provides rich asynchronous DNS resolver capabilities.
673
653=item L<AnyEvent::HTTPD> 674=item L<AnyEvent::HTTPD>
654 675
655Provides a simple web application server framework. 676Provides a simple web application server framework.
656
657=item L<AnyEvent::DNS>
658
659Provides rich asynchronous DNS resolver capabilities.
660 677
661=item L<AnyEvent::FastPing> 678=item L<AnyEvent::FastPing>
662 679
663The fastest ping in the west. 680The fastest ping in the west.
664 681

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines