Question: I am mulling over a web-app in Perl that will allow users to create bug monitors. So essentially each "bug watch" will be a bug ID that will be passed to a sub routine along with the "sleep" time, and once the "sleep time" is over it must recur without blocking the parent process or the peer processes.

* I tried [Schedule::Cron](http://search.cpan.org/dist/Schedule-Cron). It supports cron-like format but here the arguments to the subs must be simple scalars hence I ruled it out.
* POE/Coro seem to be another options but I don't have much idea about it/ :(

Any insights ? TIA

-Matt.

Answer: 
What's wrong with Schedule::Cron? You can make any subroutine reference that you like, so you can make closures that refer to the extra or specific data you need. You don't have to rely on the argument list. Was there something else about the module that didn't work for you?
> 
> I tried Schedule::Cron. It supports cron-like format but here the arguments to the subs must be simple scalars hence I ruled it out.
> 
> 
> 

The Schedule::Cron documentation says that *arguments* is a *Reference to array containing arguments to be used when calling the subroutine*. Pass a reference to a named array of your arguments, if you wish. Since the cron entry holds a reference to @data you can add or remove @data elements in your code as needed.

```
$cron->add_entry(
    '* * * * *',
    subroutine => \&mysub,
    arguments => \@data,
);

```

You can also use a closure, as Brian suggested:

```
my $var = 42;
my @arr = get_stuff();

$cron->add_entry(
    '* * * * *',
    sub { mysub($var, @arr) },
);

```

See the [perlref](http://perldoc.perl.org/perlref.html) man page for more information on closures.