NAME
Sub::CharacterProperties - Support for user-defined character properties
VERSION
version 1.100860
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.
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.
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
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
or Is
. If this argument is omitted, a dummy name - InFoo
- is used.
INSTALLATION
See perlmodinstall for information and options on installing Perl modules.
BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests through the web interface at http://rt.cpan.org/Public/Dist/Display.html?Name=Sub-CharacterProperties.
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://search.cpan.org/dist/Sub-CharacterProperties/.
The development version lives at http://github.com/hanekomu/Sub-CharacterProperties/. Instead of sending patches, please fork this project using the standard git and github infrastructure.
AUTHOR
Marcel Gruenauer <marcel@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2007 by Marcel Gruenauer.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.