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.
@(brian d foy): The reasons why i think Schedule::Cron is good for me 
1: $cron->add\_entry doesn't seem to provide me an option to pass @arrays/$vars to the subs.

$cron->add\_entry("$temp",{'subroutine' => \&test1,'arguments' => \@array}); is not allowed.

2: I am not sure if there is a way to add new cron entry after cron->run(detach=>1); has been fired without restarting the script..