[PATCH] AnyEvent::Handle

Maxime Soulé btik-cpan at scoubidou.com
Tue Jul 3 10:55:56 CEST 2012

Hello Marc,

Le 30.03.2012 05:10, Marc Lehmann a écrit :
> On Mon, Mar 26, 2012 at 03:07:08PM +0200, Maxime Soulé<btik-cpan at scoubidou.com>  wrote:
>> In one case, there is a problem when handling bogus serialized
>> Storable data.
> This is the patch I actually applied, it should improve my and your code in
> almost every respect :) It would be gerat if you could give it a test (or the
> cvs version of AnyEvent, but there are a lot of changes going on there).
> http://ue.tst.eu/ad155ce1c025fcfcb2beda9a2c17807b.txt

In fact, better late than never :), there is a problem with this 

eval { $cb->($_[0], Storable::thaw ($data)); 1 }
    or return $_[0]->_error (Errno::EBADMSG);

If an exception is thrown by the callback, it will be trapped and 
assimilated to a "Bad Message", which is wrong...

I think that exceptions thrown by the callback should not be caught at 
this level.

To avoid using a local variable, it can be changed to :

$cb->($_[0], eval { Storable::thaw ($data) } || return $_[0]->_error 

Best regards,


More information about the anyevent mailing list