in reply to What should I call my module?

I have a unicore/html_alias.pl (amongst others) to be use in conjunction with the charnames pragma, like this:
use charnames ":alias" => ":html"; print "\N{pound}\N{sup2}"'
It’ll probably make it into the 5.15 development cycle. The start of it looks like this:
############################################################### # # File "html_alias.pl" containing aliases for use with # # use charnames ":alias" => ":html"; # # Each section in table below is grouped and sorted not by alias # name but rather so one can visually locate a desired character. # # To view table sorted by key, see unused DATA section below. # ############################################################### use utf8; use strict; use warnings qw[ FATAL all ]; # "return" is to quiet perl -wc return ( # Number aliases: these are \p{Other_Number} "sup1" => "SUPERSCRIPT ONE", # ¹ U+00B9 "sup2" => "SUPERSCRIPT TWO", # ² U+00B2 "sup3" => "SUPERSCRIPT THREE", # ³ U+00B3 "frac12" => "VULGAR FRACTION ONE HALF", # ½ U+00BD "frac14" => "VULGAR FRACTION ONE QUARTER", # ¼ U+00BC "frac34" => "VULGAR FRACTION THREE QUARTERS", # ¾ U+00BE # Currency sign aliases: \p{Currency_Symbol} "curren" => "CURRENCY SIGN", # ¤ U+00A4 "cent" => "CENT SIGN", # ¢ U+00A2 "pound" => "POUND SIGN", # £ U+00A3 "yen" => "YEN SIGN", # ¥ U+00A5 "euro" => "EURO SIGN", # € U+20AC
Does that look useful to you?

Replies are listed 'Best First'.
Re^2: What should I call my module?
by John M. Dlugosz (Monsignor) on May 09, 2011 at 21:40 UTC
    Maybe... I was thinking that the most generally accessible way to have the data would be to map the entity name to an integer. Also have a reverse lookup. For validating, it doesn't matter what's in the value since I'll just check for key existence.

    In order to use your list for anything other than the charnames construct or perhaps displaying a readable form, you would have to look up the value to resolve the actual character or code number.

    I'm all for having only one list of all the Entities stored somewhere for all code to draw upon. Maybe it should present a lookup API that can return any or all of those items and how it's stored internally is opaque.

    What do you think?