Provided by: libnumber-phone-perl_3.6006-1_all
NAME
Number::Phone::Formatters - how to write custom formatters
DESCRIPTION
How to write custom formatters for phone numbers.
NAMING
Formatters are modules that live in the "Number::Phone::Formatter::*" namespace. Users only need to type the last bit of the name, without the leading "Number::Phone::Formatter::", when calling the "format_using" method of Number::Phone. The 'E123' formatter name is reserved and implemented by Number::Phone subclasses in their "format()" methods. The 'FishAndChips' formatter name is reserved because I needed something guaranteed to not exist so I could test that it failed correctly.
METHODS
There is one compulsory method, "format" that you must write. It will be called as a class method, with a number in E.123 international format as its first argument, looking something like '+CC NNN NNN NNN', and a Number::Phone object as its second argument. The gory details of what E.123 looks like are at <http://www.itu.int/rec/T-REC-E.123/en> but in summary, you'll get a string consisting of: a plus sign a 1, 2 or 3 digit country code whitespace a mixture of digits and whitespace You should return a string.
EXAMPLE
See Number::Phone::Formatter::Raw for an example that uses the string argument, and Number::Phone::Formatter::NationallyPreferredIntl for one that uses the object.
COPYRIGHT and LICENCE
Copyright 2016 David Cantrell <david@cantrell.org.uk> This documentation is free-as-in-speech software. It may be used, distributed, and modified under the terms of the Creative Commons Attribution-Share Alike 2.0 UK: England & Wales License, whose text you may read at <http://creativecommons.org/licenses/by-sa/2.0/uk/>.