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: 
> 
> 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.
If u do decide to look into [Coro](http://search.cpan.org/dist/Coro/Coro.pm) then it might be worth having a look at [Continuity](http://search.cpan.org/dist/Continuity/lib/Continuity.pm) as this is a web library/framework built around Coro. 

Also take a look at [Squatting](http://search.cpan.org/dist/Squatting/lib/Squatting.pm) web microframework which "squats" on top of [Continuity by default](http://search.cpan.org/dist/Squatting/lib/Squatting/On/Continuity.pm). The Squatting distro comes with some examples of using [Coro::Event](http://search.cpan.org/dist/Coro/Event/Event.pm).