Mon Oct 1 17:09:23 2001 0 127.0.0.1 2611 1774034 a _ o r tmbranno ftp 0 * c
Mon Oct 1 17:09:27 2001 0 127.0.0.1 22 1774034 a _ o r tmbranno ftp 0 * c
Mon Oct 1 17:09:27 2001 0 127.0.0.1 22 file with spaces in it.zip a _ o r tmbranno ftp 0 * c
Mon Oct 1 17:09:31 2001 0 127.0.0.1 7276 p1774034_11i_zhs.zip a _ o r tmbranno ftp 0 * c
####
our @field = qw(day_name month day current_time year transfer_time
remote_host file_size filename transfer_type special_action_flag
direction access_mode username service_name authentication_method
authenticated_user_id completion_status);
my %field;
@field{@field} = split /\s+/, $line;
####
sub parse_line {
my $self = shift; my $line = shift or die "must supply xferlog line";
my @field = qw(day_name month day current_time year transfer_time
remote_host file_size filename transfer_type
special_action_flag direction access_mode username
service_name authentication_method authenticated_user_id
completion_status);
my %field;
my @tmp = split /\s+/, $line;
if (scalar @tmp == scalar @field) {
@field{@field} = @tmp;
} else {
for (@field) {
last if $_ eq 'filename';
$field{$_} = shift @tmp;
}
@field = reverse @field;
@tmp = reverse @tmp;
for (@field) {
last if $_ eq 'filename';
$field{$_} = shift @tmp;
}
@tmp = reverse @tmp ;
$field{filename} = "@tmp";
}
# map { print "$_ => $field{$_} \n" } @field;
# print "-------------------";
\%field;
}