NAME
MooseX::Types::Vehicle - Moose Types for Vehicles (NHSTA 17 char VIN)
SYNOPSIS
This module provide the type VIN17. This type can be used in Moose code.
use MooseX::Types::Vehicle qw/VIN17/;
has 'vin' => ( isa => VIN17, is => 'rw' );
Alternatively, you can have it automagically coerce to a VIN if possible:
use MooseX::Types::Vehicle qw/VIN17/;
has 'vin' => ( isa => VIN17, is => 'rw', coerce => 1 );
Lastly, all MooseX::Types modules can export a function for is_TYPE and to_TYPE.
use MooseX::Types::Vehicle qw/to_VIN17 is_VIN17/;
## Return a VIN number without spaces, with the 'O' (letter) as '0' (number zero)
## 'I' (letter) as '1' (number one) and without spaces.
to_VIN17( '3D7KS28C26G 18OO4I ' );
## Returns 1 or 0 if the VIN is valid.
is_VIN17( '3D7KS28C26G180041' );
DESCRIPTION
This module currently only impliments the NHSTA 17 Digit VIN check and applicable coercions. Applicable coercions include trimming whitespace, and transliterating invalid characters to their valid coutnerparts "qQoO" (letter 'q' and 'o') to "0" (number zero), and "iI" (letter 'I') to '1' (number one).
This module assumes VINs must be uppercase to be valid. Lowercase characters are uppercased in coercion.
A VIN check is a checksum against the VIN.
For more information see the "SEE ALSO".
EXPORT
This module can export two functions both of which are explained in the synopsis.
- to_VIN17
-
Takes a string, returns a coerced string.
- is_VIN17
-
Determines whether or not a string is a valid 17 character VIN. Returns boolean 1 or 0.
SEE ALSO
- MooseX::Types
- https://en.wikipedia.org/wiki/National_Highway_Traffic_Safety_Administration
-
This is the website of the NHTSA. They created this VIN shit. I never read any of their texts. Got any ideas on how to improve the VIN standard? I'm sure they'll be glad to listen to your advice.
- https://en.wikipedia.org/wiki/Vehicle_identification_number
-
This is a great resource for more information about the VIN numbers.
AUTHOR
Evan Carroll, <me at evancarroll.com>
BUGS
Please report any bugs or feature requests to bug-moosex-types-vehicle at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MooseX-Types-Vehicle. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc MooseX::Types::Vehicle
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=MooseX-Types-Vehicle
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
LICENSE AND COPYRIGHT
Copyright 2012 Evan Carroll http://www.evancarroll.com.
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.