From 8c4e88468f5919a65232c9ed39aca496d37c6584 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Wed, 19 May 2010 12:25:43 +0000 Subject: [PATCH] Bugfixing git-svn-id: http://svn.brehm-online.com/svn/my-stuff/Perl@77 ec8d2aa5-1599-4edb-8739-2b3a1bc399aa --- lib/FrBr/Common/MooseX/Role/FtpClient.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/FrBr/Common/MooseX/Role/FtpClient.pm b/lib/FrBr/Common/MooseX/Role/FtpClient.pm index 76de976..b218ffe 100644 --- a/lib/FrBr/Common/MooseX/Role/FtpClient.pm +++ b/lib/FrBr/Common/MooseX/Role/FtpClient.pm @@ -913,13 +913,17 @@ sub _parse_date { my $self = shift; my $date_str = shift; - my ( $month_str, $day, $hour, $minute ); + my ( $year, $month_str, $day, $hour, $minute ); - unless ( ( $month_str, $day, $hour, $minute ) = $date_str =~ /^(\S{3})\S*\s+(\d+)\s+(\d+):(\d+)/ ) { + unless ( ( $month_str, $day, $hour, $minute, $year ) = $date_str =~ /^(\S{3})\S*\s+(\d+)\s+(?:(\d+):(\d+)|\d{4})/ ) { $self->warn( sprintf( "Konnte Datum '%s' nicht auseinandernehmen.", $date_str ) ); return undef; } + $hour = 0 unless defined $hour; + $minute = 0 unless defined $minute; + $year = 0 unless defined $year; + $month_str = lc($month_str); my $month = $month_map->{$month_str}; @@ -930,9 +934,9 @@ sub _parse_date { my $now = DateTime->now()->set_time_zone( $self->local_timezone ); - my $this_year = $now->year; + my $this_year = $year || $now->year; my $create_hash = { - year => $this_year, + year => $this_year + 0, month => $month, day => $day + 0, hour => $hour + 0, -- 2.39.5