Tisconv v1.2.2 - convert phone numbers to new Slovenian numberning scheme
use Tisconv;
$conv = Tisconv::new;
print $conv->converted if $conv->convert('+386 (61) 1334111');
Beginning at the end of March 2000, nearly all phone numbers in Slovenia will undergo changes. In addition to that, the area codes will also change. This package is used to convert old to new phone numbers.
It can use either the built-in table of rules or do an on-line lookup at http://tis.telekom.si/.
If you use the table-based conversion, this module is all you need.
If you want to do on-line lookups you must have the LWP (libwww-perl) package (available at CPAN) installed on your computer and must (of course :) have access to the Web.
The package has been tested on an SGI Indy running Irix 6.2 and Perl 5.005_02 and on a PC running WinNT 4.0 SP5 and Perl 5.005_03. The CGI frontend has been tested on the Indy with Apache 1.3b3.
Unless explicitly specified, the methods return the last supplied argument. The following methods are available:
Constructor for converter. Returns a reference to a Tisconv object.
This method converts a number by matching it in the table of rules or by doing an on-line lookup (the useweb method determines which conversion will be performed).
This method returns an integer value. The values are:
0 - An error occured during conversion. This can happen if the format of input number was illegal or the number does not exist. Be careful: there are numbers which the table-based conversion will happily convert, but which do not exist in reality. A textual explanation of the error is returned by method error_message. The converted method returns the input number prefixed with an asterix (e.g., ``*+386 (61) 284 184'').
1 - The conversion was successful. The converted method returns the converted number in the chosen format.
2 - The input number format is legal, but it is either a foreign number or a number in one of the Slovenian GSM or NMT networks. The converted method returns the input number.
Returns the converted number. If no conversion was performed, it returns the original number. If an error occured during conversion, it returns the original number prefixed with an asterisk.
If the last conversion produced an error, returns the error message, otherwise returns undef.
Load the table of rules from the file $filename. Returns nothing. The latest table is available from http://17slon.com/telefon/pravila.shtml .
Note: By default you do not need to load the table of rules, as the module always contains a recent table and should be updated within few days of a new table release. This method is useful if a new table is released, but the Tisconv package has not yet been updated.
This method determines whether to use the on-line lookup (if $flag == 1) or the table of rules (if $flag == 0). Default is to use the table.
If the old and new numbers differ only in area codes, the on-line lookup doesn't report the new area code. In this case the table is used to determine the new area code.
If you are using on-line lookups and are behind a firewall, you can use this to get past the proxy. If $port is omitted, it defaults to 80.
Returns a list ($address,$port).
Defines the default area code. Without it, numbers without the area code will not get converted.
If this is defined, area codes matching $code will not get written out, unless the output format contains the international prefix (see OUTPUT FORMATS).
This defines the output separator for the phone number (e.g., '-' or ' '). Defaults to '' (i.e., no separator).
The integer value $format determines how the output will be formatted. See OUTPUT FORMATS for the list of formats available. Defaults to 0.
Returns an array of example outputs for each defined format (this can be useful for printing help). The separator is assumed to be '-'.
The integer value $format determines how the 7-digit numbers should be written. See OUTPUT FORMATS for the list of formats available. Defaults to 0. If the separator (see separator method) is '' (i.e., no separator), this value is ignored.
Returns an array of example outputs for both 7-digit number formats (this can be useful in printing help). The separator is assumed to be '-'.
Returns an array of legal old area codes;
Returns an array of legal new area codes;
The package will convert numbers in any of the following formats:
Full international format, e.g., +386 (61) 133 41 11, +386 611334111 or +386611334111.
Without the international prefix, e.g., (61) 133 41 11, 061/1334111 or 061 133 41 11.
Just the phone number: 133 41 11. This will only be accepted if you set the default old area code.
Input numbers may also contain separators. In fact, anything except digits, parentheses and a leading + is simply discarded.
There are many output formats to choose from. The desired format is chosen with methods format (global output format) and format7 (7-digit numerb format). The following tables list the integer values suitable for feeding into these methods. The abbreviations used are: Int - international code, Area - area code without the leading 0 and Phone - phone number.
+Int (Area) Phone
+Int Area/Phone
+Int Area Phone
+Int AreaPhone
+IntAreaPhone
(Area) Phone
Area/Phone
Area Phone
AreaPhone
(0Area) Phone
0Area/Phone
0Area Phone
0AreaPhone
ddd dd dd
ddd dddd
The table of rules was downloaded from http://17slon.com/telefon/pravila.shtml . The version used in this package is 3.09, released on 4th August 2000.
The rules, as well as the Windows-based converter, which was the source for some ideas and output formats, were compiled and written by Primoz Gabrijelcic, http://17slon.com/gp/
To read more about phone number changes, see http://17slon.com/telefon/
Copyright (c) 2000, Jan Kalin <jan.kalin@zag.si>, all rights reserved. The latest version of this package can be found on http://charm.zag.si/eng/perl/tisconv/
This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.