| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Regexp::Common::SEN; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 72 |  |  | 72 |  | 655 | use 5.10.0; | 
|  | 72 |  |  |  |  | 159 |  | 
| 4 |  |  |  |  |  |  |  | 
| 5 | 72 |  |  | 72 |  | 256 | use strict; | 
|  | 72 |  |  |  |  | 80 |  | 
|  | 72 |  |  |  |  | 1267 |  | 
| 6 | 72 |  |  | 72 |  | 249 | use warnings; | 
|  | 72 |  |  |  |  | 717 |  | 
|  | 72 |  |  |  |  | 1634 |  | 
| 7 | 72 |  |  | 72 |  | 202 | no  warnings 'syntax'; | 
|  | 72 |  |  |  |  | 127 |  | 
|  | 72 |  |  |  |  | 2078 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 | 72 |  |  | 72 |  | 237 | use Regexp::Common qw /pattern clean no_defaults/; | 
|  | 72 |  |  |  |  | 85 |  | 
|  | 72 |  |  |  |  | 354 |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | our $VERSION = '2017040401'; | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | =begin does_not_exist | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | sub par11 { | 
| 16 |  |  |  |  |  |  | my $string = shift; | 
| 17 |  |  |  |  |  |  | my $sum    = 0; | 
| 18 |  |  |  |  |  |  | for my $i (0 .. length ($string) - 1) { | 
| 19 |  |  |  |  |  |  | my $c = substr ($string, $i, 1); | 
| 20 |  |  |  |  |  |  | $sum += $c * (length ($string) - $i) | 
| 21 |  |  |  |  |  |  | } | 
| 22 |  |  |  |  |  |  | !($sum % 11) | 
| 23 |  |  |  |  |  |  | } | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | =end does_not_exist | 
| 26 |  |  |  |  |  |  | =cut | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | # http://www.ssa.gov/history/ssn/geocard.html | 
| 29 |  |  |  |  |  |  | pattern name   => [qw /SEN USA SSN -sep=-/], | 
| 30 |  |  |  |  |  |  | create => sub { | 
| 31 |  |  |  |  |  |  | my $sep = $_ [1] {-sep}; | 
| 32 |  |  |  |  |  |  | "(?k:(?k:[1-9][0-9][0-9]|0[1-9][0-9]|00[1-9])$sep"   . | 
| 33 |  |  |  |  |  |  | "(?k:[1-9][0-9]|0[1-9])$sep"                     . | 
| 34 |  |  |  |  |  |  | "(?k:[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|"     . | 
| 35 |  |  |  |  |  |  | "00[1-9][0-9]|000[1-9]))" | 
| 36 |  |  |  |  |  |  | }, | 
| 37 |  |  |  |  |  |  | ; | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | =begin does_not_exist | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | It's not clear whether this is the right checksum. | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | # http://www.google.nl/search?q=cache:8m1zKNYrEO0J:www.enschede.nl/nieuw/projecten/aanbesteding/integratie/pve%2520Bijlage%25207.5.doc+Sofi+nummer+formaat&hl=en&start=56&lr=lang_en|lang_nl&ie=UTF-8 | 
| 44 |  |  |  |  |  |  | pattern name   => [qw /SEN Netherlands SoFi/], | 
| 45 |  |  |  |  |  |  | create => sub { | 
| 46 |  |  |  |  |  |  | # 9 digits (d1 d2 d3 d4 d5 d6 d7 d8 d9) | 
| 47 |  |  |  |  |  |  | # 9*d1 + 8*d2 + 7*d3 + 6*d4 + 5*d5 + 4*d6 + 3*d7 + 2*d8 + 1*d9 | 
| 48 |  |  |  |  |  |  | # == 0 mod 11. | 
| 49 |  |  |  |  |  |  | qr /([0-9]{9})(?(?{par11 ($^N)})|(?!))/; | 
| 50 |  |  |  |  |  |  | } | 
| 51 |  |  |  |  |  |  | ; | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | =end does_not_exist | 
| 54 |  |  |  |  |  |  | =cut | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | 1; | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | __END__ |