Business-DK-Phonenumber
view release on metacpan or search on metacpan
lib/Business/DK/Phonenumber.pm view on Meta::CPAN
default.
=head2 generate($template, $amount)
This subroutine takes a string representing a phone number template and generates
the amount specified by second argument: amount. If no amount is specified only
a single random phone number is returned.
The subroutine returns an array, no matter what amount is specified.
=head2 _generate($template)
This is the actual generating method used by L</generate>.
It takes a single parameter, a string indicating the template for the formatting
of the phone numbers to be generated.
It returns a single random number representing a Danish phone number formatted
as outlined by the specified template.
=head2 validate_template
This method is used internally to validate template parameters. Please refer to
Perl's sprintf for documentation.
=head1 DIAGNOSTICS
=over
=item * phone number not in recognisable format, the phone number provided to
the constructor is not parsable. Please evaluate what you are attempting to
feed to the constructor.
=item * phone number parameter is mandatory for the constructor, please specify
the phone number parameter to the constructor in order to continue.
=item * template not in recognisable format, the template provided to the
constructor is not in a parsable format, please evaluate what you attempting to
feed to the constructor.
=back
=head1 CONFIGURATION AND ENVIRONMENT
No special configuration or environment is necessary.
=head1 DEPENDENCIES
=over
=item * L<Carp>
=item * L<Exporter>
=back
=head1 INCOMPATIBILITIES
No known incompatibilities at this time.
=head1 BUGS AND LIMITATIONS
No known bugs or limitations at this time.
=head1 TEST AND QUALITY
=over
=item * The L<Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators>
policy has been disabled. We are working with phonenumbers, strings consisting primarily of number, so not special interpretation or calculative behaviour is needed.
=item * L<Perl::Critic::Policy::ValuesAndExpressions::ProhibitConstantPragma> policy has been disabled. I like constants.
=item * L<Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint> policy has been disabled for now should be revisited at some point.
=back
=head1 TODO
=over
=item * Please refer to the distribution TODO file
=back
=head1 SEE ALSO
=over
=item L<sprintf>
Business::DK::Phonenumber utilizes sprintf to as templating system for
formatting telephonenumbers. This is a well specified and tested interface
which is easy to use.
=item L<Class::Business::DK::Phonenumber>
An OOP approach to regarding a Danish phone number as an object
=item L<Data::FormValidator::Constraints::Business::DK::Phonenumber>
Wrapper for integrating with L<Data::FormValidator>
=back
=head1 BUG REPORTING
Please report issues via CPAN RT:
L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Business-DK-Phonenumber>
or by sending mail to
bug-Business-DK-Phonenumber@rt.cpan.org
=head1 MOTIVATION
I have been working in Telco for a long time. So validation and formatting of
telephone numbers is something I have seen at lot of. This module is an attempt
to sort of consolidate the numerous different regular expression solutions
I have seen scattered over large code bases.
( run in 1.849 second using v1.01-cache-2.11-cpan-364913b4093 )