.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.37 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .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. | will give a .\" real vertical bar. \*(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-|\(bv\*(Tr .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" '' 'br\} .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Number::Phone::Normalize 3" .TH Number::Phone::Normalize 3 "2010-01-20" "perl v5.8.8" "User Contributed Perl Documentation" .SH "NAME" Number::Phone::Normalize \- Normalizes format of Phone Numbers. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Number::Phone::Normalize; .Ve .PP .Vb 2 \& print phone_intl('+1 (555) 123 4567'); # +1 555 1234567 \& print phone_local('+49-89-99999999','CountryCode'=>'49'); # 089 99999999 .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module takes a phone (or E.164) number in different input formats and outputs it in accordance to E.123 or in local formats. .Sh "\s-1FUNCTIONS\s0" .IX Subsection "FUNCTIONS" .ie n .IP "phone_intl( $number\fR, \f(CW%params )" 4 .el .IP "phone_intl( \f(CW$number\fR, \f(CW%params\fR )" 4 .IX Item "phone_intl( $number, %params )" Normalizes the phone number \f(CW$number\fR and returns it in international (E.164) format. \f(CW$number\fR can be in an international format or in a local format if the \&\f(CW\*(C`CountryCode\*(C'\fR/\f(CW\*(C`AreaCode\*(C'\fR parameters are supplied. .Sp If \f(CW\*(C`phone_intl\*(C'\fR does not have enough information to build an international number (e.g. \f(CW$number\fR does not contain a country code and \f(CW%param\fR does not specify a default), it returns \f(CW\*(C`undef\*(C'\fR. .ie n .IP "phone_local( $number\fR, \f(CW%params )" 4 .el .IP "phone_local( \f(CW$number\fR, \f(CW%params\fR )" 4 .IX Item "phone_local( $number, %params )" Normalizes the phone number \f(CW$number\fR and returns it in local format. \f(CW$number\fR can be in an international format or in a local format if the \f(CW\*(C`CountryCode\*(C'\fR/\f(CW\*(C`AreaCode\*(C'\fR parameters are supplied. .Sp If \f(CW\*(C`phone_local\*(C'\fR does not have enough information to build an international number (e.g. \f(CW$number\fR does not contain a country code and \f(CW%param\fR does not specify a default), it returns \f(CW\*(C`undef\*(C'\fR. .Sh "\s-1METHODS\s0" .IX Subsection "METHODS" There is also an object-oriented interface, which allows you to specify the parameters once, in the constructor. .ie n .IP "new( %params )" 4 .el .IP "new( \f(CW%params\fR )" 4 .IX Item "new( %params )" Creates an object that carries default parameters: .Sp .Vb 1 \& $nlz = Number::Phone::Normalize->new( %params ); .Ve .ie n .IP "$nlz\->intl( $number\fR [, \f(CW%more_params] )" 4 .el .IP "$nlz\->intl( \f(CW$number\fR [, \f(CW%more_params\fR] )" 4 .IX Item "$nlz->intl( $number [, %more_params] )" .PD 0 .ie n .IP "$nlz\->local( $number\fR [, \f(CW%more_params] )" 4 .el .IP "$nlz\->local( \f(CW$number\fR [, \f(CW%more_params\fR] )" 4 .IX Item "$nlz->local( $number [, %more_params] )" .PD These functions are equivalent to \f(CW\*(C`phone_intl\*(C'\fR and \&\f(CW\*(C`phone_local\*(C'\fR but use the \f(CW%params\fR passed to \f(CW\*(C`new\*(C'\fR as default. .Sp I.e., the following calls: .Sp .Vb 2 \& Number::Phone::Normalize->new( %p1 )->intl( $number, %p2 ) \& Number::Phone::Normalize->new( %p1 )->local( $number, %p2 ) .Ve .Sp are equivalent to the follwoing: .Sp .Vb 2 \& phone_intl( $number, %p1, %p2 ); \& phone_local( $number, %p1, %p2 ); .Ve .Sh "\s-1COMMON\s0 \s-1PARAMETERS\s0" .IX Subsection "COMMON PARAMETERS" All functions, constructors and methods take the following parameters. Parameters specified in method calls override those given to the constructor. .PP \fIfor input\fR .IX Subsection "for input" .PP These parameters specify how the input \f(CW$number\fR is interpreted if it is in a non-international format. .ie n .IP """CountryCode""" 4 .el .IP "\f(CWCountryCode\fR" 4 .IX Item "CountryCode" The local country code. It is added to phone numbers in local format without an country code. .ie n .IP """AreaCode""" 4 .el .IP "\f(CWAreaCode\fR" 4 .IX Item "AreaCode" The local area code. It is added to phone numbers in local format without an area code. .ie n .IP """IntlPrefix""" 4 .el .IP "\f(CWIntlPrefix\fR" 4 .IX Item "IntlPrefix" The international prefix. If \f(CW$number\fR starts with this prefix, the country code and area code are taken from the number. .Sp The default is '00' (\s-1ITU\s0 recommendation). .ie n .IP """LDPrefix""" 4 .el .IP "\f(CWLDPrefix\fR" 4 .IX Item "LDPrefix" The long distance prefix. If \f(CW$number\fR starts with this prefix, the area code is taken from \f(CW$number\fR and the country code is taken from the \f(CW\*(C`CountryCode\*(C'\fR parameter. .Sp If \f(CW$number\fR starts with neither \f(CW\*(C`IntlPrefix\*(C'\fR nor \f(CW\*(C`LDPrefix\*(C'\fR, it is assumed to be in local format and both country and area codes are taken from the parameters. .Sp The default is '0' (\s-1ITU\s0 recommendation). .PP \fIfor output\fR .IX Subsection "for output" .PP These parameters control formatting of the output. Most parameters only affect output in local format. .IP "CountryCodeOut" 4 .IX Item "CountryCodeOut" The local country code. If the number does not have the \f(CW\*(C`CountryCode\*(C'\fR specified, it is returned starting with the \f(CW\*(C`IntlPrefix\*(C'\fR. .IP "AreaCodeOut" 4 .IX Item "AreaCodeOut" The local country code. If the number does not have the \f(CW\*(C`CountryCode\*(C'\fR specified, it is returned starting with the \f(CW\*(C`LDPrefix\*(C'\fR. .ie n .IP """IntlPrefixOut""" 4 .el .IP "\f(CWIntlPrefixOut\fR" 4 .IX Item "IntlPrefixOut" The international prefix for output. If the number is not in the country specified by \f(CW\*(C`CountryCode\*(C'\fR, the returned number will start with this prefix. .Sp The default is \f(CW\*(C`IntlPrefix\*(C'\fR. .Sp You can set this parameter to '+' in order to return numbers in international format instead of the local format. .ie n .IP """LDPrefixOut""" 4 .el .IP "\f(CWLDPrefixOut\fR" 4 .IX Item "LDPrefixOut" The long distance prefix for output. It the number is not in the area specified by \f(CW\*(C`AreaCode\*(C'\fR or \f(CW\*(C`AlwaysLD\*(C'\fR is set to true, it is returned starting with \f(CW\*(C`LDPrefixOut\*(C'\fR. .Sp The default is LDPrefix. .ie n .IP """AlwaysLD""" 4 .el .IP "\f(CWAlwaysLD\fR" 4 .IX Item "AlwaysLD" If set to true, the number will always be returned with an area code, even if it is in the country and area specified by \f(CW\*(C`CountryCode\*(C'\fR and \f(CW\*(C`AreaCode\*(C'\fR. .ie n .IP """VanityOK""" 4 .el .IP "\f(CWVanityOK\fR" 4 .IX Item "VanityOK" If set to true, vanity numbers will not be converted to numeric format. .SH "BUGS AND LIMITATIONS" .IX Header "BUGS AND LIMITATIONS" The module does not support more complex dialling plans. It is mostly intended for data input and output (especially to and from databases), but not to prepare numbers for dialling. .SH "AUTHOR" .IX Header "AUTHOR" Claus Fa\*:rber .SH "LICENSE" .IX Header "LICENSE" Copyright 2004\-2009 Claus Fa\*:rber. .PP It is free software; you can redistribute it and/or modify it under the same terms as perl itself, either version 5.5.0 or, at your option, any later version.