package AnyData::Format::Kuzuha;
use strict;
use AnyData::Format::Base;
use vars qw(@ISA);
@ISA = qw(AnyData::Format::Base);

sub new {
	my ($class,$flg) = @_;
	$flg ||= {};
	$flg->{col_names} = 'ndate,postid,protect,thread,phost,agent,user,mail,title,msg';
	my $self = AnyData::Format::Base->new($flg);
	return bless $self,$class;
}

sub read_fields {
	my ($self,$rec) = @_;
	my (@row) = $rec =~ split /,/,$rec;
	return map { tr/\0/,/d } @row;
}

sub write_fields {
	my ($self,@rec) = @_;
	foreach (@rec) {
		s/\015\012/\015/g;
		s/\012/\015/g;
		s/\015+$//;
		tr/,/\0/d;
	}
	return(join(',',@rec) . "\012");
}

1;
__END__

=head1 NAME

	AnyData::Format::Kuzuha -- easy access to bbs.log of Kuzuha Script

=head1 SYNOPSIS

	use strict;
	use DBI;

	my $dbh = DBI->connec('dbi:AnyData',undef,undef,{RaiseError => 1, AutoCommit => 1});

	$dbh->func('bbslog','Kuzuha','bbs.log','ad_catalog');

	my $sth = $dbh->prepare('SELECT * FROM bbslog ORDER BY postid');
	$sth->execute;
	while (my $data = $sth->fetchrow_arrayref) {
		print '<pre>',join(' ',@$data),'</pre>';
	}

	$sth->finish;
	$dbh->disconnect;

=cut
