Hi all,
I have a random question that is bugging me. I have a perl script that uses the Data::ICal::DateTime module to parse out existing ical entries in an ICS local file which is dumped into a sql database. The script works beautiful when run manually, but fails on a cron job. Error log when running state the following error:
"Can't locate object method "events" via package "Class::ReturnValue" at /script.pl line 60.
Line 60 is the code below:
my @events1 = $cal->events($span);
So its somehow thinking I'm using the Class::ReturnValue of the $cal variable instead of the Data::ICal module, but again, this only happens on the crontab, manual launch works fine. I have various other modules on other scripts that work fine on a crontab, but this is the only one that has failed. No special formatting or directory changes occur here...so I'm stumped. Any ideas? Please see sample script below:
#!/usr/bin/perl
use strict;
use Data::ICal::DateTime;
my $date1 = DateTime->new( year => 2012);
my $date2 = DateTime->new( year => 2013);
my $span = DateTime::Span->from_datetimes( start => $date1, end => $d
+ate2 );
my $cal = Data::ICal->new(filename => 'Calendar.ics');
my @events1 = $cal->events($span);
foreach my $event (@events1) {
my $summary = $event->summary;
my $start = $event->start;
my $end = $event->end;
# Continue sql insertion next...
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.