ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-poe
perl-poe
Re: when working with files under POE, shouldn't IO::AIO be used?
by David Davis other posts by this author
Dec 13 2006 4:55PM messages near this date
Re: when working with files under POE, shouldn't IO::AIO be used? | Working with archives
Here is my working example:

http://svn.xantus.org/shortbus/trunk/cometd-perl/lab/aio.pl

David


On 12/13/06, Rocco Caputo <rcaputo@[...].com>  wrote:
> 
>  Although Marc Lehmann doesn't come out and say so, IO::AIO provides
>  two features that support its use from POE in a couple different ways.
> 
>  It exposes a file descriptor, which can be used to notify select-like
>  loops when AIO operations are complete.  For example:
> 
>     # POE integration
>     open my $fh, "<&=" . IO::AIO::poll_fileno or die "$!";
>     $_[KERNEL]->select_read($fh, "aio_event");
> 
>  Or you can use its callback mechanism with POE::Session's postback()
>  or callback():
> 
>     aio_open "/etc/passwd", O_RDONLY, 0, $_[SESSION]->postback
>  ("aio_open_event");

Whether you "should" use IO::AIO is a matter of your application's
>  requirements.  Quite a lot of systems don't require AIO, so they
>  shouldn't use IO::AIO.
> 
>  I hope this helps.
> 
>  --
>  Rocco Caputo - rcaputo@[...].com
> 
>  On Dec 11, 2006, at 04:42, aninnymouse@[...].com wrote:
> 
>  > According to the documentation that only does buffered I/O. There are
>  > many other file operations that can block, which IO::AIO deals with-
>  > file opening and creation, closing and deletion, link/symlink, stat,
>  > rename, etc.  Does POE handle those as well?
>  >
>  > Matt Sickler wrote:
>  >> why use IO::AIO when there is POE::Wheel::ReadWrite?
>  >>
>  >> On 9 Dec 2006 21:37:14 -0800, aninnymouse@[...].com
>  >> <aninnymouse@[...].com>
>  >> wrote:
>  >>>
>  >>> To avoid blocking when doing file operations under POE, shouldn't
>  >>> IO::AIO be used? I haven't seen any mention or examples of two being
>  >>> used together.  If somebody has done this already, can they post an
>  >>> example here or on the wiki. Thanks.
>  >>>
>  >>> Also, there was a brief mention [1] on the djabberd mailing list
>  >>> that
>  >>> Brad would like to bring Danga::Socket and POE together. Any
>  >>> thoughts
>  >>> from this camp?
>  >>>
>  >>> [1] http://lists.danga.com/pipermail/djabberd/2006-October/
>  >>> 000198.html
>  >>>
>  >>>
>  >>
>  >> ------=_Part_72409_23861310.1165808259206--
> 
> 
> 
Thread:
Rocco Caputo
David Davis

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved