http://www.perlmonks.org?node_id=1002869


in reply to Re^5: Tie::File failing with Unicode/UTF-8 encoding?
in thread Tie::File failing with Unicode/UTF-8 encoding?

Hello HelenCR.

I just thought setting bval option would solve this crlf problem, but DB_File allows only one byte for record delimitor (sorry, I didn't know this ...). DB_File document says

Also note that the bval option only allows you to specify a single byte as a delimiter.

So as you say, Filter_Push for crlf will work.

my @Tied; my $Filename='087.txt'; my $dbh = new DB_File::RECNOINFO ; $dbh->{bval}="\n"; #set bval explicitly my $db = tie @Tied, 'DB_File', $Filename, O_CREAT | O_RDWR, 0644, $dbh or die "failed top open $Filename"; #utf8 $db->Filter_Push('encode' => 'UTF-8'); #add crlf filter $db->Filter_Push( Fetch => sub { s/\r\n$/\n/;}, #convert crlf to lf Store => sub { $_ .="\r"; }, #add cr ); # ... same as before
For documents, I like HTML pages of search.cpan.org
DB_File
DBM_Filter
And you will have "t" directory for each modules, which is for testing. Scripts in "t" directory gives me hints for usages.

regards, good luck.