Algorithm-LUHN_XS
view release on metacpan or search on metacpan
Ie it returns true if the final character of CHECKSUMMED_NUM is the
correct checksum for the rest of the number and false if not.
Obviously the final character does not factor into the checksum
calculation. False will also be returned if NUM contains in an
invalid character as defined by valid_chars(). If NUM is not valid,
$Algorithm::LUHN_XS::ERROR will contain the reason.
This function is equivalent to
substr $N,length($N)-1 eq check_digit(substr $N,0,length($N)-1)
For example, "4242 4242 4242 4242" is a valid Visa card number, that
is provided for test purposes. The final digit is '2', which is the
right check digit. If you change it to a '3', it's not a valid card
number. Ie:
is_valid('4242424242424242'); # true
is_valid('4242424242424243'); # false
is_valid_fast CHECKSUMMED_NUM
Ie it returns true if the final character of CHECKSUMMED\_NUM is the
correct checksum for the rest of the number and false if not. Obviously the
final character does not factor into the checksum calculation. False will also
be returned if NUM contains in an invalid character as defined by
valid\_chars(). If NUM is not valid, $Algorithm::LUHN\_XS::ERROR will contain the
reason.
This function is equivalent to
substr $N,length($N)-1 eq check_digit(substr $N,0,length($N)-1)
For example, `4242 4242 4242 4242` is a valid Visa card number,
that is provided for test purposes. The final digit is '2',
which is the right check digit. If you change it to a '3', it's not
a valid card number. Ie:
is_valid('4242424242424242'); # true
is_valid('4242424242424243'); # false
- is\_valid\_fast CHECKSUMMED\_NUM
lib/Algorithm/LUHN_XS.pm view on Meta::CPAN
Ie it returns true if the final character of CHECKSUMMED_NUM is the
correct checksum for the rest of the number and false if not. Obviously the
final character does not factor into the checksum calculation. False will also
be returned if NUM contains in an invalid character as defined by
valid_chars(). If NUM is not valid, $Algorithm::LUHN_XS::ERROR will contain the
reason.
This function is equivalent to
substr $N,length($N)-1 eq check_digit(substr $N,0,length($N)-1)
For example, C<4242 4242 4242 4242> is a valid Visa card number,
that is provided for test purposes. The final digit is '2',
which is the right check digit. If you change it to a '3', it's not
a valid card number. Ie:
is_valid('4242424242424242'); # true
is_valid('4242424242424243'); # false
=cut
( run in 0.608 second using v1.01-cache-2.11-cpan-65fba6d93b7 )