9 require "../t/charset_tools.pl";
11 eval { require Encode; };
14 print "1..0 # Skip: Encode is not available\n";
19 require "dbm_filter_util.pl";
21 use Test::More tests => 20;
23 BEGIN { use_ok('DBM_Filter') };
27 foreach (qw/SDBM_File ODBM_File NDBM_File GDBM_File DB_File/) {
28 if ($Config{extensions} =~ /\b$_\b/) {
35 BEGIN { use_ok('Fcntl') };
36 BEGIN { use_ok('charnames', qw{greek})};
38 use charnames qw{greek};
41 END { unlink <Op_dbmx*>; }
44 my $db1 = tie(%h1, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
46 ok $db1, "tied to $db_file";
48 eval { $db1->Filter_Push('utf8') };
49 is $@, '', "push a 'utf8' filter" ;
52 no warnings 'uninitialized';
57 'alpha' => "\N{alpha}",
58 "\N{gamma}"=> "gamma",
65 'alpha' => "\N{alpha}",
67 "\N{gamma}"=> "gamma",
73 use warnings FATAL => 'untie';
75 is $@, '', "untie without inner references" ;
78 # read the dbm file without the filter
80 my $db2 = tie(%h2, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
82 ok $db2, "tied to $db_file";
86 'alpha' => byte_utf8a_to_utf8n("\xCE\xB1"),
87 'beta' => byte_utf8a_to_utf8n("\xCE\xB2"),
88 byte_utf8a_to_utf8n("\xCE\xB3")=> "gamma",
94 use warnings FATAL => 'untie';
96 is $@, '', "untie without inner references" ;