/usr/share/perl5/AnyData/Format/Text.pm is in libanydata-perl 0.12-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | #########################################################
package AnyData::Format::Text;
#########################################################
# AnyData driver for plain text files
# copyright (c) 2000, Jeff Zucker <jeff@vpservices.com>
#########################################################
use strict;
use warnings;
use AnyData::Format::Base;
use AnyData::Storage::FileSys;
use vars qw( @ISA $DEBUG );
@AnyData::Format::Text::ISA = qw( AnyData::Format::Base );
$DEBUG = 0;
sub new {
my $class = shift;
my $self = shift || {};
#use Data::Dumper; die Dumper $self;
$self->{rec_sep} ||= "\n";
if ($self->{dirs}) {
$self->{storage} = 'FileSys';
$self->{col_names} = 'fullpath,path,name,ext,size,content';
$self->{records} = get_data( {},$self->{dirs} );
}
else {
$self->{col_names} = 'text';
$self->{key} = 'text';
}
$self->{keep_first_line} = 1;
return bless $self, $class;
}
sub write_fields {
my $self = shift;
return $self->{dirs}
? pop @_
: join '', @_;
}
sub read_fields {
my $self = shift;
my $str = shift || return undef;
if (!$self->{dirs}) {
my @row = ($str);
return @row
}
}
sub get_data {
my $self = shift;
my $dirs = shift;
# my @col_names = @{ $self->{col_names} };
my $table = [];
my @files = AnyData::Storage::FileSys::get_filename_parts(
dirs => $dirs
);
for my $file_info(@files) {
my $file = $file_info->[0];
# my $cols = get_mp3_tag($file) || next;
#my $filesize = -s $file;
#my @row = (@$file_info,$filesize);
my @row = ( $file_info->[0],
$file_info->[2],
$file_info->[1],
$file_info->[3],
);
push @$table, \@row;
# 'fullpath,path,name,ext,size,content';
# 'fullpath,file_name,path,ext,size,'
# 'name,artist,album,year,comment,genre';
}
return $table;
}
1;
|