You can add the current year to your string value prior to parsing.
my $val = Sep 1 05:39:02;
# Grab the year either via exec or via DateTime, your choice
chomp(my $year = `date '+%Y'`);
# --or--
my $year = strftime('%Y',localtime(time));
# Then combine and parse the string value into a DT
It'd also be good to fix the bug where errors don't work if croak is
disabled. Makes it real hard to do good automated processing of
potentially bad input.
On Thu, Sep 02, 2010 at 10:55:16AM -0700, Matthew Hall wrote:
On Thu, Sep 02, 2010 at 01:24:03PM -0400, Metz, Bobby wrote:
You can add
On Thu, Sep 02, 2010 at 01:24:03PM -0400, Metz, Bobby wrote:
You can add the current year to your string value prior to parsing.
Thanks. I'll adopt the DateTime based version in your second mail.
You're welcome.
Of course you could also alter you syslog config to include the year,
On Thu, 2 Sep 2010, Metz, Bobby wrote:
-Original Message-
From: Metz, Bobby
# Grab the year either via exec or via DateTime, your choice
chomp(my $year = `date '+%Y'`);
# --or--
my $year = strftime('%Y',localtime(time));
My apologies, I said using DateTime above but I used a POSIX
On Thu, Sep 02, 2010 at 01:51:42PM -0500, Dave Rolsky wrote:
Or you could do the simple version ...
DateTime-now()-year();
Good call. Implemented.
-dave
Matthew.