ra93013 has asked for the wisdom of the Perl Monks concerning the following question:

Hello - I'm testing Schedule::Cron. I ran the following code and I can see Schedule::Cron MainLoop - next execution time but the dispatcher is not printing ID or Args and the check_links is not being invoked. What am I doing wrong here?
#!/usr/bin/perl use Schedule::Cron; # Subroutines to be called sub dispatcher { print "ID: ",shift,"\n"; print "Args: ","@_","\n"; } sub check_links { $datetime = scalar(localtime(time)); open(F,'>>datetime.dat') || die $!; print F "$datetime\n"; close(F); } # Create new object with default dispatcher my $cron = new Schedule::Cron(\&dispatcher); $cron->add_entry("0-59/1 * * * Mon-Fri",\&check_links); # Run scheduler $cron->run(detach=>1);

Replies are listed 'Best First'.
Re: schedule::cron Not Working
by marinersk (Priest) on Nov 05, 2013 at 18:15 UTC
    You don't seem to be checking your return values to ensure you are creating and utilizing objects correctly.

    Without further examination, I'd check those first.