Data::Validate::WithYAML::Plugin::Country - check whether a given value is a valid country code
version 0.03
Your test.pl
:
use Data::Validate::WithYAML;
my $validator = Data::Validate::WithYAML->new( 'validate.yml' );
my %params = (
country => 'DE',
# more user input
);
my %errors = $validator->validate( \%params );
Your validate.yml
:
---
country:
type: required
plugin: Country
format: alpha-2
lang: en
Currently this module supports to formats: alpha-2 that are two-letter country codes like 'DE', 'FR', etc. and alpha-3 that is the three-letter code (e.g. DEU, FRA).
And it supports different languages so you use the country codes in your preferred language (see Locale::Country::Multilingual
).
Check if the given value is a valid country code.
The distribution is contained in a Git repository, so simply clone the repository
$ git clone git://github.com/reneeb/Data-Validate-WithYAML-Plugin-Country.git
and change into the newly-created directory.
$ cd Data-Validate-WithYAML-Plugin-Country
The project uses Dist::Zilla
to
build the distribution, hence this will need to be installed before
continuing:
$ cpanm Dist::Zilla
To install the required prequisite packages, run the following set of commands:
$ dzil authordeps --missing | cpanm
$ dzil listdeps --author --missing | cpanm
The distribution can be tested like so:
$ dzil test
To run the full set of tests (including author and release-process tests),
add the --author
and --release
options:
$ dzil test --author --release
Renee Baecker reneeb@cpan.org
This software is Copyright (c) 2012 by Renee Baecker.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)