.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Number::Phone::Formatters 3pm" .TH Number::Phone::Formatters 3pm "2020-09-08" "perl v5.30.3" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Number::Phone::Formatters \- how to write custom formatters .SH "DESCRIPTION" .IX Header "DESCRIPTION" How to write custom formatters for phone numbers. .SH "NAMING" .IX Header "NAMING" Formatters are modules that live in the \f(CW\*(C`Number::Phone::Formatter::*\*(C'\fR namespace. Users only need to type the last bit of the name, without the leading \f(CW\*(C`Number::Phone::Formatter::\*(C'\fR, when calling the \f(CW\*(C`format_using\*(C'\fR method of Number::Phone. .PP The 'E123' formatter name is reserved and implemented by Number::Phone subclasses in their \f(CW\*(C`format()\*(C'\fR methods. .PP The 'FishAndChips' formatter name is reserved because I needed something guaranteed to not exist so I could test that it failed correctly. .SH "METHODS" .IX Header "METHODS" There is one compulsory method, \f(CW\*(C`format\*(C'\fR 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 \s-1NNN NNN NNN\s0', and a Number::Phone object as its second argument. The gory details of what E.123 looks like are at but in summary, you'll get a string consisting of: .IP "a plus sign" 4 .IX Item "a plus sign" .PD 0 .IP "a 1, 2 or 3 digit country code" 4 .IX Item "a 1, 2 or 3 digit country code" .IP "whitespace" 4 .IX Item "whitespace" .IP "a mixture of digits and whitespace" 4 .IX Item "a mixture of digits and whitespace" .PD .PP You should return a string. .SH "EXAMPLE" .IX Header "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. .SH "COPYRIGHT and LICENCE" .IX Header "COPYRIGHT and LICENCE" Copyright 2016 David Cantrell <\fIdavid@cantrell.org.uk\fR> .PP 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 \s-1UK:\s0 England & Wales License, whose text you may read at .