String::ProperCase::Surname - Converts Surnames to Proper Case
use String::ProperCase::Surname; print ProperCase($surname);
The package String::ProperCase::Surname is an Exporter that exports exactly one function called ProperCase. The ProperCase function is for use on Surnames which handles cases like O'Neal, O'Brien, McLean, etc.
After researching the proper case issues there are three different use cases with a wide variety of loose rules. This algorithm is customized for surnames. Other uses such as "TitleCase" and "MenuCase" have different algorithms. The main difference is that in surnames the letter following an apostrophe is always uppercase (e.g. "O'Brien") in title case and menu case the letter is always lowercase (e.g. "They're").
OR
require String::ProperCase::Surname; print String::ProperCase::Surname::ProperCase($surname);
use String::ProperCase::Surname qw{}; *pc=\&String::ProperCase::Surname::ProperCase; print pc($surname);
You can add or delete custom mixed case surnames to/from this hash.
Delete
delete($String::ProperCase::Surname::surname{lc($_)}) foreach qw{MacDonald MacLeod};
Add
$String::ProperCase::Surname::surname{lc($_)}=$_ foreach qw{DaVis};
Note: All keys are lower case and values are mixed case.
Function returns the correct case given a surname.
print ProperCase($surname);
Note: All "Mc" last names are assumed to be mixed case.
Log on RT and email the Author
Surname default mixed case hash will never be perfect for every implementation.
DavisNetworks.com supports all Perl applications including this package.
Michael R. Davis CPAN ID: MRDVT qw/perl michaelrdavis com/ http://www.davisnetworks.com/
This program is free software licensed under the...
The BSD License
The full text of the license can be found in the LICENSE file included with this module.
Lingua::EN::Titlecase, Spreadsheet::Engine::Function::PROPER
To install String::ProperCase::Surname, copy and paste the appropriate command in to your terminal.
cpanm
cpanm String::ProperCase::Surname
CPAN shell
perl -MCPAN -e shell install String::ProperCase::Surname
For more information on module installation, please visit the detailed CPAN module installation guide.