I just repeat myself. But i invested much effort into "Data::Type" (wa
+s Data::Verify) which actually does all what you are talking about. I
+t encapsulates many CPAN "value type" checking modules already.
Business::ISSN 0.90 by ISSN
Locale::SubCountry by LOCALE::COUNTRYCODE, LOCALE::COUNTRYNAME, LO
+CALE::REGIONCODE, LOCALE::REGIONNAME
Net::IPv6Addr 0.2 by IP
Locale::Language 2.02 by LOCALE::LANGCODE, LOCALE::LANGNAME
Business::CINS 1.13 by CINS
Email::Valid 0.14 by EMAIL
Date::Parse 2.23 by DATE
Business::CreditCard 0.27 by CREDITCARD
Regexp::Common 2.104 by INT, IP, QUOTED, REAL, URI
Business::UPC 0.02 by UPC
An update will hit CPAN/SF.net soon.
From the pod:
Data::Type x.x.x supports 44 types:
BINARY - binary code
BOOL - a true or false value
CINS 0.1.3 - a CUSIP International Numbering System Nu
+mber
BIO::CODON 0.1.3 - a DNA (default) or RNA nucleoside triphos
+phates triplet
LOCALE::COUNTRYCODE 0.1.5 - country code
LOCALE::COUNTRYNAME 0.1.5 - country name
CREDITCARD - is one of a set of creditcard type (DINER
+S, BANKCARD, VISA, ..
DATE 0.1.1 - a date (mysql or Date::Parse conform)
DATETIME - a date and time combination
DEFINED 0.1.4 - a defined (not undef) value
DK::YESNO - a simple answer (ja, nein)
BIO::DNA 0.1.3 - a dna sequence
DOMAIN 0.1.4 - a network domain name
EMAIL - an email address
ENUM - a member of an enumeration
GENDER - a gender male, female
HEX - hexadecimal code
INT - an integer
IP 0.1.4 - an IP (V4, V6, MAC) network address
ISSN 0.1.3 - an International Standard Serial Number
LOCALE::LANGCODE 0.1.3 - a Locale::Language language code
LOCALE::LANGNAME 0.1.3 - a language name
LONGTEXT - text with a max length of 4294967295 (2^3
+2 - 1) characters (..
MEDIUMTEXT - text with a max length of 16777215 (2^24
+- 1) characters (al..
NUM - a number
OS::PATH 0.1.6 - a path string (not really functional)
PORT 0.1.4 - a network port number
QUOTED - a quoted string
REAL - a real
REF - a reference to a variable
LOCALE::REGIONCODE 0.1.5 - region code
LOCALE::REGIONNAME 0.1.5 - region name
BIO::RNA 0.1.3 - a rna sequence
SET - a set (can have a maximum of 64 members (
+mysql))
TEXT - blob with a max length of 65535 (2^16 - 1
+) characters (alias..
TIME - a time (mysql)
TIMESTAMP - a timestamp (mysql)
TINYTEXT - text with a max length of 255 (2^8 - 1) c
+haracters (alias my..
UPC 0.1.3 - standard (type-A) Universal Product Code
URI - an http uri
VARCHAR - a string with limited length of choice (d
+efault 60)
WORD - a word (without spaces)
YEAR - a year in 2- or 4-digit format
YESNO - a simple answer (yes, no)
And 4 filters:
chomp - chomps
lc - lower cases
strip - strip
uc - upper cases
TYPES BY GROUP
Locale
LOCALE::COUNTRYCODE, LOCALE::COUNTRYNAME, LOCALE::LANGCODE, LOCALE::
+LANGNAME, LOCALE::REGIONCODE, LOCALE::REGIONNAME
Logic
BIO::CODON, BIO::DNA, BIO::RNA, DEFINED, DOMAIN, EMAIL, IP, OS::PATH
+, PORT, REF, URI
Database
Logic
ENUM, SET
Time or Date related
DATE, DATETIME, TIME, TIMESTAMP, YEAR
String
LONGTEXT, MEDIUMTEXT, TEXT, TINYTEXT
Business
CINS, CREDITCARD, ISSN, UPC
W3C
String
BINARY, HEX
Numeric
BOOL, INT, NUM, REAL
String
DK::YESNO, GENDER, QUOTED, VARCHAR, WORD, YESNO
GROUP "Database"
These are types identical to mysql database builtin types.
CREDITCARD
This type isn't tested at all and nobody should rely on it without rig
+orous testing.
Supported are: 'Diners Club', 'Australian BankCard', 'VISA', 'Discover
+/Novus', 'JCB', 'MasterCard', 'Carte Blache', 'American Express'.
They are parameterised as: DINERS, BANKCARD, VISA, DISCOVER, JCB, MAST
+ERCARD, BLACHE, AMEX.
CONTRIBUTIONS
The author is happy to receive more types (formats) and add to this li
+brary. If you
have a algorithm/regex for validating it, the better. Just email me.
PREREQUISITES
Class::Maker (0.05.10),
Error (0.15),
IO::Extended (0.05),
Tie::ListKeyedHash (0.41),
Iter (0)
and for types
Business::ISSN 0.90 by ISSN
Locale::SubCountry by LOCALE::COUNTRYCODE, LOCALE::COUNTRYNAME, LO
+CALE::REGIONCODE, LOCALE::REGIONNAME
Net::IPv6Addr 0.2 by IP
Locale::Language 2.02 by LOCALE::LANGCODE, LOCALE::LANGNAME
Business::CINS 1.13 by CINS
Email::Valid 0.14 by EMAIL
Date::Parse 2.23 by DATE
Business::CreditCard 0.27 by CREDITCARD
Regexp::Common 2.104 by INT, IP, QUOTED, REAL, URI
Business::UPC 0.02 by UPC
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.