Skip Menu |

This queue is for tickets about the IO-KQueue CPAN distribution.

Report information
The Basics
Id: 62936
Status: new
Priority: 0/
Queue: IO-KQueue

Owner: Nobody in particular
Requestors: leonerd-cpan [...]

Bug Information
Severity: (no value)
Broken in: 0.34
Fixed in: (no value)

Subject: Methods should not croak by default
Download (untitled) / with headers
text/plain 1.3k
If you call $kqueue->EV_SET( $fd, EVFILT_READ, EV_DELETE ) on a file descriptor that isn't actually being watched on anyway, it will throw an exception by croak. It's common in fact, that this happens because kqueue will in fact stop watching a file descriptor you close()d, so this ends up throwing an exception. Instead, if it simply returned true or undef on failure, the way most system call wrappers do, we could just rely on $! to ignore these nonfatal errors: $kqueue->EV_SET(..) or $! == ENOENT or croak "EV_SET failed - $!"; It's not especially nice to just eval{}-wrap it, because then you catch all failures. Since after the eval{} returns you can't really rely on the value of $!, you'd have to test the string exception name, which now depends on the locale's idea of what ENOENT stringifies as. Ideally I'd request that EV_SET does not throw exceptions; instead allowing the caller to simply "... or die" as is the usual Perl idiom. However, there may be some API compatibility issues preventing this, because of existing code. In that case perhaps, could there be a method EV_SET_nothrow that simply returns undef, in the usual Perl way. You can then trivially wrap this in sub EV_SET { shift->EV_SET_nothrow( @_ ) or croak "EV_SET failed - $!"; } for compatibility. I'd be happy to supply a patch to do this if required. -- Paul Evans

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to