Validate-CodiceFiscale

 view release on metacpan or  search on metacpan

lib/Validate/CodiceFiscale.pm  view on Meta::CPAN

sub validate_cf ($cf, %options) {
   my $r = _decode_and_validate($cf, %options);
   my $errors = $r->{errors} // [];
   return scalar($errors->@*) ? $errors : undef;
} ## end sub validate_cf

# The following is useful for one-lines:
#
#     $ perl -MValidate::CodiceFiscale=r -er bcadfe88a48h501p
#
sub r (@args) {
   @args = @ARGV unless @args;
   my $i = 0;
   my $n = 0;
   for my $cf (@ARGV) {
      if (my $errors = validate_cf($cf)) {
         say "$i not ok - " . join(', ', $errors->@*);
         ++$n;
      }
      else {
         say "$i ok - $cf";



( run in 0.743 second using v1.01-cache-2.11-cpan-524268b4103 )