NAME

Data::Validate::VIN - Perl extension for basic validation of North American Vehicle Identification Numbers (model years 1980 - 2039)

VERSION

0.05

SYNOPSIS

use Data::Validate::VIN;

my $vv = Data::Validate::VIN->new($somePotentialVIN);

if ( $vv->valid() ) {
    print $vv->get('vin'), "\n";
}
else {
    print "$_\n" for @{ $vv->errors() };
}

DESCRIPTION

Data::Validate::VIN provides a simple way to validate the very basics of North American VINs. The only information this module can glean from a valid VIN is the country of manufacture and the model year (where year is between 1980 and 2039).

It cannot tell you if a VIN corresponds to an actual vehicle in the world, it just knows what most VINs look like.

The following checks are run:

Length

17 characters expected

The following are allowed :

A-H,J-N,P,R-Z,0-9

The following are illegal in the 10th position:

U,Z,0

Country of Manufacture

Identified through the first two characters in the WMI

Year

Identified by the 10th character in the VIN

Model year between 1980 and 2039

Check Digit

This is the 9th character in the VIN

VEHICLE IDENTIFICATION NUMBERS

Vehicle Identification Numbers in North America since 1980 can be, very basically and in brief, broken down into three sections: the WMI (World Manufacturer Identifier), the VDS (Vehicle Descriptor Section) and the VIS (Vehicle Identifier Section).

The WMI is the first three characters in the VIN. The first two of these identify manufacturer of the vehicle.

The VDS is the fourth through ninth characters in the VIN. This is typically unique per manufacturer. The ninth digit is the check digit.

The VIS is used to identify the particular vehicle in question.

METHODS

new()

Accepts an alphanumeric string which will be automatically run through the checks outlined above

valid()

Returns 1 if the string sent through new() passed all checks. Returns undef otherwise

errors()

Returns an array ref containing any errors encountered while checking the string. Will return an empty array ref if the string passed all tests.

get()

Returns a piece of the VIN or data gleaned from the VIN. Accepts the following:

vin - will always be returned unless an empty string was passed to new()

vid

vis

checkdigit

country

year - returns an array ref, as some characters refer to multiple years.

SEE ALSO

http://www.access.gpo.gov/nara/cfr/waisidx_05/49cfr565_05.html

http://en.wikipedia.org/wiki/Vehicle_Identification_Number

AUTHOR

collin seaton, <cseaton at cpan.org>

BUGS

Please report any bugs or feature requests to bug-data-validate-vin at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Data-Validate-VIN. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

Fork me on Github: https://github.com/chilledham/Data-Validate-VIN

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Data::Validate::VIN

You can also look for information at:

THANKS

Thanks to the following contributors:

moltar

WARRANTY

None.

LICENSE AND COPYRIGHT

Copyright 2011 collin seaton.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.