in reply to perl module not working in crontab

Ignore what others say about @INC and PERL5LIB. It's not a problem loading Class::ReturnValue.

The docs say:

Returns a false value upon failure to open or parse the file or data; this false value is a Class::ReturnValue object and can be queried as to its error_message.

so

my $cal = Data::ICal->new(filename => 'Calendar.ics');

should be

my $cal = Data::ICal->new(filename => 'Calendar.ics'); die "Can't open calendar: ".$cal->error_message()."\n" if !$cal;

I bet you'll the problem is that your script can't find Calendar.ics because the current directory isn't what you assume it to be.

Replies are listed 'Best First'.
Re^2: perl module not working in crontab
by omegaweaponZ (Beadle) on Jan 03, 2012 at 02:15 UTC
    Ahhh!!! You rock. I can't believe I didn't catch that, nice job. And that's why I post the full script :)

      Always that a script fail in your crontab, check 'env' output before launch it (and compare both (inside crontab and outside)), like ikegami says, this time CWD var has the reason of failure