Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Async-Defer CPAN distribution.

Report information
The Basics
Id: 78178
Status: rejected
Priority: 0/
Queue: Async-Defer

People
Owner: Nobody in particular
Requestors: TOSHIOITO [...] cpan.org
Cc: powerman [...] powerman.name
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.9.0
Fixed in: (no value)



CC: powerman [...] powerman.name
Subject: Async::Defer rejects Defer children even when they are its subclass
In do() and _do_batch() methods of Async::Defer, ref($task) is directly compared against __PACKAGE__. Because of this, it rejects any non-Async::Defer object for a child defer, even if the child directly inherits Async::Defer. As far as I read the source code, the only requirement the child must satisfy is that it implements run() and clone() methods properly. Therefore, I would appreciate it greatly if you change the argument check from given (ref $task) { ... when (__PACKAGE__) { ... } to something like if(blessed($task) && $task->can('run') && $task->can('clone')) { ... } Background: Since an Async::Defer object cannot be run multiple times simultaneously (I think it's OK as a module), I'm writing a subclass of Async::Defer that automatically clones itself before running. It also manages a built-in job queue to control the maximum number of active instances. I call it Async::Defer::Queue. It is not on CPAN (yet), but is on Github https://github.com/debug-ito/Async-Defer-Queue However, because of the argument check described above, Async::Defer::Queue cannot be nested. Of course, overriding do() and _do_batch() method may resolve the problem, but that approach is ugly and a bit inefficient. p.s. I put your personal email address to CC in this bug report, in case you don't pay attention to RT CPAN. I'm sorry if that was redundant. ----- Toshio ITO debug.ito@gmail.com
RT-Send-CC: powerman [...] powerman.name
Update: I decided not to use inheritance to implement Async::Defer::Queue. Async::Defer::Queue now includes Async::Defer, and it delegates most of Async::Defer's public APIs to the Async::Defer object. This is more loosely-coupled and thus maintainable way to extend a module, I guess. Because of this change, the behavior-based argument checking I wrote above is more desirable than class-based checking. Show quoted text
> Background: > > Since an Async::Defer object cannot be run multiple times > simultaneously (I think it's OK as a module), I'm writing a subclass > of Async::Defer that automatically clones itself before running. It > also manages a built-in job queue to control the maximum number of > active instances. > > I call it Async::Defer::Queue. It is not on CPAN (yet), but is on > Github https://github.com/debug-ito/Async-Defer-Queue > > However, because of the argument check described above, > Async::Defer::Queue cannot be nested. Of course, overriding do() and > _do_batch() method may resolve the problem, but that approach is ugly > and a bit inefficient. > > > p.s. > > I put your personal email address to CC in this bug report, in case > you don't pay attention to RT CPAN. I'm sorry if that was redundant. > > > ----- > Toshio ITO > debug.ito@gmail.com