1MARC::Charset::Table(3)User Contributed Perl DocumentatioMnARC::Charset::Table(3)
2
3
4
6 MARC::Charset::Table - character mapping db
7
9 use MARC::Charset::Table;
10 use MARC::Charset::Constants qw(:all);
11
12 # create the table object
13 my $table = MARC::Charset::Table->new();
14
15 # get a code using the marc8 character set code and the character
16 my $code = $table->lookup_by_marc8(CYRILLIC_BASIC, 'K');
17
18 # get a code using the utf8 value
19 $code = $table->lookup_by_utf8(chr(0x043A));
20
22 MARC::Charset::Table is a wrapper around the character mapping
23 database, which is implemented as a tied hash on disk. This database
24 gets generated by Makefile.PL on installation of MARC::Charset using
25 MARC::Charset::Compiler.
26
27 The database is essentially a key/value mapping where a key is a MARC-8
28 character set code + a MARC-8 character, or an integer representing the
29 UCS code point. These keys map to a serialized MARC::Charset::Code
30 object.
31
32 new()
33 The consturctor.
34
35 add_code()
36 Add a MARC::Charset::Code to the table.
37
38 get_code()
39 Retrieve a code using a hash key.
40
41 lookup_by_marc8()
42 Looks up MARC::Charset::Code entry using a character set code and a
43 MARC-8 value.
44
45 use MARC::Charset::Constants qw(HEBREW);
46 $code = $table->lookup_by_marc8(HEBREW, chr(0x60));
47
48 lookup_by_utf8()
49 Looks up a MARC::Charset::Code object using a utf8 value.
50
51 db()
52 Returns a reference to a tied character database. MARC::Charset::Table
53 wraps access to the db, but you can get at it if you want.
54
55 db_path()
56 Returns the path to the character encoding database. Can be called
57 statically too:
58
59 print MARC::Charset::Table->db_path();
60
61 brand_new()
62 An alternate constructor which removes the existing database and starts
63 afresh. Be careful with this one, it's really only used on
64 MARC::Charset installation.
65
66
67
68perl v5.30.0 2019-07-26 MARC::Charset::Table(3)