Anything wrong with using AnyEvent::Handle for files?

Mike Schilli office at perlmeister.com
Mon Aug 24 00:52:40 CEST 2015


Got it, using

    sysseek( $fh, 0, 1 );

(as there's no systell(), according to perldoc -f tell), gives a count
of 14 all three times, because the underlying sysread() call reads all
the way to the end of the file the first time. It won't help to
determine how much bytes AnyEvent::handle has read so far (because of
the buffering), but keeping a byte count manually will. Thanks!

On Tue, Aug 11, 2015 at 8:07 AM, Marc Lehmann <schmorp at schmorp.de> wrote:
> On Mon, Aug 10, 2015 at 07:15:04PM -0700, Mike Schilli <office at perlmeister.com> wrote:
>> that $fh isn't advanced, so "tell $fh" stays at 0 and subsequent
>> checks (e.g. for meanwhile appended data) fail:
>
> tell in perl only works on buffered I/O, I think? you'd have to use
> sysseek (see perldoc -f tell) to query the kernel to get the actual file
> pointer.
>
> --
>                 The choice of a       Deliantra, the free code+content MORPG
>       -----==-     _GNU_              http://www.deliantra.net
>       ----==-- _       generation
>       ---==---(_)__  __ ____  __      Marc Lehmann
>       --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
>       -=====/_/_//_/\_,_/ /_/\_\



More information about the anyevent mailing list