use Crontab;
$cs = '0-59/2 * * * *';

print "Checking for $cs\n";

($cs_min,$cs_hour,$cs_dom,$cs_mon,$cs_dow) = split(/\s+/,$cs);

while (1) {
  ($sec,$min,$hour,$dom,$mon,$year,$dow,$yday,$isdst) = localtime(time);

  print "  min ($cs_min $min) ",(($cs_min  eq '*' or Set::Crontab->new($cs_min,[0-59])->contains($min))?"":"no ")," match\n";
  print "  hour ($cs_hour $hour) ",(($cs_hour eq '*' or Set::Crontab->new($cs_hour,[0-23])->contains($hour))?"":"no ")," match\n";
  print "  dom ($cs_dom $dom) ",(($cs_dom  eq '*' or Set::Crontab->new($cs_dom,[1-31])->contains($dom))?"":"no ")," match\n";
  print "  mon ($cs_mon $mon) ",(($cs_mon  eq '*' or Set::Crontab->new($cs_mon,[1-12])->contains($mon+1))?"":"no ")," match\n";
  print "  dow ($cs_dow $dow) ",(($cs_dow  eq '*' or Set::Crontab->new($cs_dow,[0-7])->contains($dow))?"":"no ")," match\n";
  sleep(10);
}
