| 1 | =head1 NAME | ||
| 2 | |||
| 3 | AnyEvent::Impl::Cocoa - AnyEvent adaptor for Cocoa::EventLoop | ||
| 4 | |||
| 5 | =head1 SYNOPSIS | ||
| 6 | |||
| 7 | use AnyEvent; | ||
| 8 | use Cocoa::EventLoop; | ||
| 9 | |||
| 10 | # do something | ||
| 11 | |||
| 12 | =head1 DESCRIPTION | ||
| 13 | |||
| 14 | This module provides NSRunLoop support to AnyEvent. | ||
| 15 | |||
| 16 | NSRunLoop is an event loop for Cocoa applications, wrapped by | ||
| 17 | L<Cocoa::EventLoop>. By using this module, you can use Cocoa based API in | ||
| 18 | your AnyEvent application, or AnyEvent within Cocoa applications. | ||
| 19 | |||
| 20 | It does not support blocking waits. | ||
| 21 | |||
| 22 | =head1 BUGS | ||
| 23 | |||
| 24 | Right now, L<Cocoa::EventLoop> (and this module) are in an early | ||
| 25 | development phase and has some shortcomings and likely bugs. | ||
| 26 | |||
| 27 | For example, there seems to be no way to just handle a single event | ||
| 28 | with Cocoa (is there nothing they can implement properly?), so this | ||
| 29 | module currently wakes up at least ten times a second when waiting for | ||
| 30 | events. Also, events caused by timers might get delayed by up to 0.1 | ||
| 31 | seconds. | ||
| 32 | |||
| 33 | =cut | ||
| 34 | |||
| 35 | package AnyEvent::Impl::Cocoa; | ||
| 36 | |||
| 37 | use AnyEvent (); BEGIN { AnyEvent::common_sense } | ||
| 38 | |||
| 39 | use Cocoa::EventLoop; | ||
| 40 | |||
| 41 | sub io { | ||
| 42 | my ($class, %arg) = @_; | ||
| 43 | |||
| 44 | Cocoa::EventLoop->io (%arg) | ||
| 45 | } | ||
| 46 | |||
| 47 | sub timer { | ||
| 48 | my ($class, %arg) = @_; | ||
| 49 | |||
| 50 | Cocoa::EventLoop->timer (%arg) | ||
| 51 | } | ||
| 52 | |||
| 53 | # does not support blocking waits | ||
| 54 | |||
| 55 | #sub loop { | ||
| 56 | # Cocoa::EventLoop->run; | ||
| 57 | #} | ||
| 58 | |||
| 59 | =head1 AUTHORS | ||
| 60 | |||
| 61 | Daisuke Murase <typester@cpan.org>, Marc Lehmann <schmorp@schmorp.de>. | ||
| 62 | |||
| 63 | =head1 COPYRIGHTS | ||
| 64 | |||
| 65 | Copyright (c) 2009 by KAYAC Inc. | ||
| 66 | Copyright (c) 2010,2011 by Marc Lehmann <schmorp@schmorp.de> | ||
| 67 | |||
| 68 | =cut | ||
| 69 | |||
| 70 | 1 | ||
| 71 |