Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re^6: Tie::File failing with Unicode/UTF-8 encoding?

by remiah (Hermit)
on Nov 08, 2012 at 10:29 UTC ( #1002869=note: print w/replies, xml ) Need Help??

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
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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1002869]
and the universe expands...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2018-05-23 01:52 GMT
Find Nodes?
    Voting Booth?