… | |
… | |
67 | package EV; |
67 | package EV; |
68 | |
68 | |
69 | use strict; |
69 | use strict; |
70 | |
70 | |
71 | BEGIN { |
71 | BEGIN { |
72 | our $VERSION = '1.4'; |
72 | our $VERSION = '1.6'; |
73 | use XSLoader; |
73 | use XSLoader; |
74 | XSLoader::load "EV", $VERSION; |
74 | XSLoader::load "EV", $VERSION; |
75 | } |
75 | } |
76 | |
76 | |
77 | @EV::IO::ISA = |
77 | @EV::IO::ISA = |
… | |
… | |
131 | innermost call to EV::loop return. |
131 | innermost call to EV::loop return. |
132 | |
132 | |
133 | When called with an argument of EV::UNLOOP_ALL, all calls to EV::loop will return as |
133 | When called with an argument of EV::UNLOOP_ALL, all calls to EV::loop will return as |
134 | fast as possible. |
134 | fast as possible. |
135 | |
135 | |
|
|
136 | =item $count = EV::loop_count |
|
|
137 | |
|
|
138 | Return the number of times the event loop has polled for new |
|
|
139 | events. Sometiems useful as a generation counter. |
|
|
140 | |
136 | =item EV::once $fh_or_undef, $events, $timeout, $cb->($revents) |
141 | =item EV::once $fh_or_undef, $events, $timeout, $cb->($revents) |
137 | |
142 | |
138 | This function rolls together an I/O and a timer watcher for a single |
143 | This function rolls together an I/O and a timer watcher for a single |
139 | one-shot event without the need for managing a watcher object. |
144 | one-shot event without the need for managing a watcher object. |
140 | |
145 | |
… | |
… | |
576 | as even with OS-supported change notifications, this can be |
581 | as even with OS-supported change notifications, this can be |
577 | resource-intensive. |
582 | resource-intensive. |
578 | |
583 | |
579 | The C<stat_ns> variant doesn't start (activate) the newly created watcher. |
584 | The C<stat_ns> variant doesn't start (activate) the newly created watcher. |
580 | |
585 | |
|
|
586 | =item ... = $w->stat |
|
|
587 | |
|
|
588 | This call is very similar to the perl C<stat> built-in: It stats (using |
|
|
589 | C<lstat>) the path specified in the watcher and sets perls stat cache (as |
|
|
590 | well as EV's idea of the current stat values) to the values found. |
|
|
591 | |
|
|
592 | In scalar context, a boolean is return indicating success or failure of |
|
|
593 | the stat. In list context, the same 13-value list as with stat is returned |
|
|
594 | (except that the blksize and blocks fields are not reliable). |
|
|
595 | |
|
|
596 | In the case of an error, errno is set to C<ENOENT> (regardless of the |
|
|
597 | actual error value) and the C<nlink> value is forced to zero (if the stat |
|
|
598 | was successful then nlink is guaranteed to be non-zero). |
|
|
599 | |
|
|
600 | See also the next two entries for more info. |
|
|
601 | |
|
|
602 | =item ... = $w->attr |
|
|
603 | |
|
|
604 | Just like C<< $w->stat >>, but without the initial stat'ing: this returns |
|
|
605 | the values most recently detected by EV. See the next entry for more info. |
|
|
606 | |
|
|
607 | =item ... = $w->prev |
|
|
608 | |
|
|
609 | Just like C<< $w->stat >>, but without the initial stat'ing: this returns |
|
|
610 | the previous set of values, before the change. |
|
|
611 | |
|
|
612 | That is, when the watcher callback is invoked, C<< $w->prev >> will be set |
|
|
613 | to the values found I<before> a change was detected, while C<< $w->attr >> |
|
|
614 | returns the values found leading to the change detection. The difference (if any) |
|
|
615 | between C<prev> and C<attr> is what triggered the callback. |
|
|
616 | |
|
|
617 | If you did something to the filesystem object and do not want to trigger |
|
|
618 | yet another change, you can call C<stat> to update EV's idea of what the |
|
|
619 | current attributes are. |
|
|
620 | |
581 | =item $w->set ($path, $interval) |
621 | =item $w->set ($path, $interval) |
582 | |
622 | |
583 | Reconfigures the watcher, see the constructor above for details. Can be |
623 | Reconfigures the watcher, see the constructor above for details. Can be |
584 | called at any time. |
624 | called at any time. |
585 | |
625 | |
… | |
… | |
749 | |
789 | |
750 | 1; |
790 | 1; |
751 | |
791 | |
752 | =head1 SEE ALSO |
792 | =head1 SEE ALSO |
753 | |
793 | |
754 | L<EV::DNS>. |
794 | L<EV::ADNS> (asynchronous dns), L<Glib::EV> (makes Glib/Gtk2 use EV as |
|
|
795 | event loop), L<Coro::EV> (efficient coroutines with EV). |
755 | |
796 | |
756 | =head1 AUTHOR |
797 | =head1 AUTHOR |
757 | |
798 | |
758 | Marc Lehmann <schmorp@schmorp.de> |
799 | Marc Lehmann <schmorp@schmorp.de> |
759 | http://home.schmorp.de/ |
800 | http://home.schmorp.de/ |