package MyApp::Controller::Root; #use strict; use warnings; use parent 'Catalyst::Controller'; use Schedule::Cron; sub test :Local { my ( $self, $c ) = @_; my $cron = new Schedule::Cron(\&dispatch,detach=>1,pid_file=>"/home/phillip/MyApp/pid.pid"); $cron->load_crontab("/var/spool/cron/perl");# I have no idea why I added this... thought it might help, and never took it out. $cron->add_entry("* * * * *",\&blah); $cron->run(pid_file=>"/home/phillip/MyApp/pid.pid"); $c->response->body('scheduled'); } sub dispatch { my ($self,$c)=@_; $c->log->debug('dispatched');} sub blah { my ( $self, $c ) = @_; open DATA, ">>./file.txt" or die "can't open this $!"; #(my $s, my $usec) = gettimeofday; my $a =localtime; print DATA $a; print DATA "\n"; close DATA; }