Bio-Das-ProServer

 view release on metacpan or  search on metacpan

lib/Bio/Das/ProServer/SourceAdaptor/Transport/csv.pm  view on Meta::CPAN

  return $self->config->{filename} || 'default';
}

sub filename {
  my $self = shift;
  return File::Spec->catfile( $self->dbname(), $self->tablename() );
}

sub last_modified {
  my $self = shift;
  return stat( $self->filename() )->mtime;
}

1;
__END__

=head1 NAME

Bio::Das::ProServer::SourceAdaptor::Transport::csv - Comma-separated-values transport layer

=head1 VERSION

lib/Bio/Das/ProServer/SourceAdaptor/Transport/file.pm  view on Meta::CPAN

    my $sep = $self->config->{'separator'} || '\t'; ## no critic (Perl::Critic::Policy::ValuesAndExpressions::RequireInterpolationOfMetachars)
    my $comment = $self->config->{'comment'};
    while(my $line = <$fh>) {
      chomp $line;
      $line || next;
      $comment && $line =~ m/$comment/mxs && next;
      my @parts = split /$sep/mxs, $line;
      push @{$ref}, \@parts;
    }
    $self->{'_contents'} = $ref;
    $self->{'_modified'} = stat($fh)->mtime; # Set the modified time
  }

  return $self->{'_contents'};
}

sub last_modified {
  my $self = shift;
  # If the file was cached, use the time from when it was loaded
  if ($self->{'_modified'}) {
    return $self->{'_modified'};
  }
  # Otherwise check it explicitly
  return stat($self->_fh())->mtime;
}

sub DESTROY {
  my $self = shift;
  if($self->{'fh'}) {
    close $self->{'fh'} or carp 'Error closing fh';
  }
  return;
}



( run in 0.727 second using v1.01-cache-2.11-cpan-49f99fa48dc )