NAME
Sub::CharacterProperties - support for user-defined character properties
SYNOPSIS
my $n = Sub::CharacterProperties->new(characters => [
'LATIN SMALL LETTER A',
'LATIN SMALL LETTER B',
'LATIN SMALL LETTER C',
'LATIN SMALL LETTER D',
...
]);
print $n->as_code('MySet');
DESCRIPTION
As described in perlunicode, you can define your own character properties. To do so, you need to specify the ranges of allowed characters as pairs of hexadecimal numbers. There are easier ways of combining ranges with +
, -
, !
and &
, but if you have a diverse set of characters you are going to have to deal with hex values.
This module aims at making your task of writing these character property subroutines easier.
Basically you create an object of this class, pass it a list of the Unicode character names of the characters you'd like to allow and then have it generate the character property subroutine.
The character property subroutines are a compile-time feature, so unfortunately this module can't just install the generated subroutine. You will have to copy-and-paste it into your program.
METHODS
- new
-
Constructs a new object. See Class::Accessor::Complex's
mk_new
for features of this constructor. - characters
-
The list of characters you would like to allow. See Class::Accessor::Complex's
mk_array_accessors
for details about which methods are available.Each character should be either a Unicode character name - such as
LATIN SMALL LETTER A
- or a hex code point - indicated by a leading "0x" - this is useful for characters that don't have a name. - get_ranges
-
Assumes that the
characters()
have been set.Returns a list of ranges containing character numeric values; each range is a Set::IntRange object.
- as_code
-
Assumes that the
characters()
have been set.Returns, as a string, the code of the subroutine you can use to implement your custom character properties.
Takes an optional string argument; this is used for the subroutine name. Note that according to perlunicode the subroutine name has to start with
In
orIs
. If this argument is omitted, a dummy name -InFoo
- is used.
TAGS
If you talk about this module in blogs, on del.icio.us or anywhere else, please use the setcharacterproperties
tag.
BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests to bug-set-characterproperties@rt.cpan.org
, or through the web interface at http://rt.cpan.org.
INSTALLATION
See perlmodinstall for information and options on installing Perl modules.
AVAILABILITY
The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit <http://www.perl.com/CPAN/> to find a CPAN site near you. Or see <http://www.perl.com/CPAN/authors/id/M/MA/MARCEL/>.
AUTHOR
Marcel Grünauer, <marcel@cpan.org>
COPYRIGHT AND LICENSE
Copyright 2007 by Marcel Grünauer
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.