AnyData
view release on metacpan or search on metacpan
lib/AnyData.pm view on Meta::CPAN
my @cols;
@cols = ref $col_names eq 'ARRAY'
? @$col_names
: split ',',$col_names;
$flags->{col_names} = \@cols;
}
$flags->{del_marker} = $del_marker;
$flags->{records} ||= $flags->{data};
$flags->{field_sep} ||= $flags->{sep_char} ||= $flags->{ad_sep_char};
$flags->{quote} ||= $flags->{quote_char} ||= $flags->{ad_quote_char};
$flags->{escape} ||= $flags->{escape_char}||= $flags->{ad_escape_char};
$flags->{record_sep}||= $flags->{eol} ||= $flags->{ad_eol};
# $flags->{skip_first_row}
my $parser = $parser_name->new ($flags);
if ($parser->{col_names} && !$col_names) {
my @cols;
@cols = ref $parser->{col_names} eq 'ARRAY'
? @{$parser->{col_names}}
: split ',',$parser->{col_names};
$flags->{col_names} = \@cols;
$parser->{col_names} = \@cols;
lib/AnyData/Format/CSV.pm view on Meta::CPAN
});
# ... other DBI/SQL operations
=head1 DESCRIPTION
This is a plug-in format parser for the AnyData and DBD::AnyData modules. It will read column names from the first row of the file, or accept names passed by the user. In addition to column names, the user may set other options as follows:
col_names : a comma separated list of column names
eol : the end of record mark, \n by default
quote_char : the character used to quote fields " by default
escape_char : the character used to escape the quote char, " by default
If you are using this with DBD::AnyData, put ad_ in front of the flags, e.g.
ad_eol.
Please refer to the documentation for AnyData.pm and DBD::AnyData.pm
for further details.
=head1 AUTHOR & COPYRIGHT
copyright 2000, Jeff Zucker <jeff@vpservices.com>
lib/AnyData/Format/CSV.pm view on Meta::CPAN
sub new {
my $class = shift;
my $self = shift || {};
my $s = ${self}->{field_rsep} || ${self}->{field_sep} || q(,);
my $s1 = $s;
#$s1 =~ s/\\/\\\\/ if $s1 =~ /\+$/;
#$s1 =~ s/\+$//;
#die $s1;
${self}->{field_sep} ||= q(,);
my $q = ${self}->{quote} ||= q(");
my $e = ${self}->{escape} ||= q(");
${self}->{record_sep} ||= qq(\n);
$self->{regex} = [
qr/$q((?:(?:$e$q)|[^$q])*)$q$s?|([^$s1]+)$s?|$s/,
"$e$q",
$q
];
return bless $self, $class;
}
sub read_fields {
lib/AnyData/Format/Tab.pm view on Meta::CPAN
});
# ... other DBI/SQL operations
=head1 DESCRIPTION
This is a plug-in format parser for the AnyData and DBD::AnyData modules. It will read column names from the first row of the file, or accept names passed by the user. In addition to column names, the user may set other options as follows:
col_names : a tab separated list of column names
eol : the end of record mark, \n by default
quote_char : the character used to quote fields " by default
escape_char : the character used to escape the quote char, " by default
If you are using this with DBD::AnyData, put ad_ in front of the flags, e.g.
ad_eol.
Please refer to the documentation for AnyData.pm and DBD::AnyData.pm
for further details.
=head1 AUTHOR & COPYRIGHT
copyright 2000, Jeff Zucker <jeff@vpservices.com>
( run in 0.396 second using v1.01-cache-2.11-cpan-c21f80fb71c )