1Pod::Escapes(3) User Contributed Perl Documentation Pod::Escapes(3)
2
3
4
6 Pod::Escapes -- for resolving Pod E<...> sequences
7
9 use Pod::Escapes qw(e2char);
10 ...la la la, parsing POD, la la la...
11 $text = e2char($e_node->label);
12 unless(defined $text) {
13 print "Unknown E sequence \"", $e_node->label, "\"!";
14 }
15 ...else print/interpolate $text...
16
18 This module provides things that are useful in decoding Pod E<...>
19 sequences. Presumably, it should be used only by Pod parsers and/or
20 formatters.
21
22 By default, Pod::Escapes exports none of its symbols. But you can
23 request any of them to be exported. Either request them individually,
24 as with "use Pod::Escapes qw(symbolname symbolname2...);", or you can
25 do "use Pod::Escapes qw(:ALL);" to get all exportable symbols.
26
28 e2char($e_content)
29 Given a name or number that could appear in a "E<name_or_num>"
30 sequence, this returns the string that it stands for. For example,
31 "e2char('sol')", "e2char('47')", "e2char('0x2F')", and
32 "e2char('057')" all return "/", because "E<sol>", "E<47>",
33 "E<0x2f>", and "E<057>", all mean "/". If the name has no known
34 value (as with a name of "qacute") or is syntactally invalid (as
35 with a name of "1/4"), this returns undef.
36
37 e2charnum($e_content)
38 Given a name or number that could appear in a "E<name_or_num>"
39 sequence, this returns the number of the Unicode character that
40 this stands for. For example, "e2char('sol')", "e2char('47')",
41 "e2char('0x2F')", and "e2char('057')" all return 47, because
42 "E<sol>", "E<47>", "E<0x2f>", and "E<057>", all mean "/", whose
43 Unicode number is 47. If the name has no known value (as with a
44 name of "qacute") or is syntactally invalid (as with a name of
45 "1/4"), this returns undef.
46
47 $Name2character{name}
48 Maps from names (as in "E<name>") like "eacute" or "sol" to the
49 string that each stands for. Note that this does not include
50 numerics (like "64" or "x981c"). Under old Perl versions (before
51 5.7) you get a "?" in place of characters whose Unicode value is
52 over 255.
53
54 $Name2character_number{name}
55 Maps from names (as in "E<name>") like "eacute" or "sol" to the
56 Unicode value that each stands for. For example, $Name2charac‐
57 ter_number{'eacute'} is 201, and $Name2character_number{'eacute'}
58 is 8364. You get the correct Unicode value, regardless of the ver‐
59 sion of Perl you're using -- which differs from %Name2character's
60 behavior under pre-5.7 Perls.
61
62 Note that this hash does not include numerics (like "64" or
63 "x981c").
64
65 $Latin1Code_to_fallback{integer}
66 For numbers in the range 160 (0x00A0) to 255 (0x00FF), this maps
67 from the character code for a Latin-1 character (like 233 for low‐
68 ercase e-acute) to the US-ASCII character that best aproximates it
69 (like "e"). You may find this useful if you are rendering POD in a
70 format that you think deals well only with US-ASCII characters.
71
72 $Latin1Char_to_fallback{character}
73 Just as above, but maps from characters (like "\xE9", lowercase
74 e-acute) to characters (like "e").
75
76 $Code2USASCII{integer}
77 This maps from US-ASCII codes (like 32) to the corresponding char‐
78 acter (like space, for 32). Only characters 32 to 126 are defined.
79 This is meant for use by "e2char($x)" when it senses that it's run‐
80 ning on a non-ASCII platform (where chr(32) doesn't get you a space
81 -- but $Code2USASCII{32} will). It's documented here just in case
82 you might find it useful.
83
85 On Perl versions before 5.7, Unicode characters with a value over 255
86 (like lambda or emdash) can't be conveyed. This module does work under
87 such early Perl versions, but in the place of each such character, you
88 get a "?". Latin-1 characters (characters 160-255) are unaffected.
89
90 Under EBCDIC platforms, "e2char($n)" may not always be the same as
91 "chr(e2charnum($n))", and ditto for $Name2character{$name} and
92 "chr($Name2character_number{$name})".
93
95 perlpod
96
97 perlpodspec
98
99 Text::Unidecode
100
102 Copyright (c) 2001-2004 Sean M. Burke. All rights reserved.
103
104 This library is free software; you can redistribute it and/or modify it
105 under the same terms as Perl itself.
106
107 This program is distributed in the hope that it will be useful, but
108 without any warranty; without even the implied warranty of mer‐
109 chantability or fitness for a particular purpose.
110
111 Portions of the data tables in this module are derived from the entity
112 declarations in the W3C XHTML specification.
113
114 Currently (October 2001), that's these three:
115
116 http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent
117 http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent
118 http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent
119
121 Sean M. Burke "sburke@cpan.org"
122
123
124
125perl v5.8.8 2004-05-07 Pod::Escapes(3)