File Coverage

blib/lib/Data/Sah/Filter/perl/Business/ID/NIK/check_nik.pm
Criterion Covered Total %
statement 8 15 53.3
branch n/a
condition 0 2 0.0
subroutine 3 5 60.0
pod 0 2 0.0
total 11 24 45.8


line stmt bran cond sub pod time code
1             package Data::Sah::Filter::perl::Business::ID::NIK::check_nik;
2              
3 1     1   443262 use 5.010001;
  1         5  
4 1     1   7 use strict;
  1         2  
  1         32  
5 1     1   6 use warnings;
  1         2  
  1         319  
6              
7             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
8             our $DATE = '2024-01-09'; # DATE
9             our $DIST = 'Sah-Schemas-Business-ID-NIK'; # DIST
10             our $VERSION = '0.003'; # VERSION
11              
12             sub meta {
13             +{
14 0     0 0   v => 1,
15             summary => 'Check that string is a valid NIK',
16             might_fail => 1,
17             };
18             }
19              
20             sub filter {
21 0     0 0   my %args = @_;
22              
23 0           my $dt = $args{data_term};
24              
25 0           my $res = {};
26              
27 0   0       $res->{modules}{"Business::ID::NIK"} //= 0;
28              
29 0           $res->{expr_filter} = join(
30             "",
31             "do { my \$tmp = $dt; my \$res = Business::ID::NIK::parse_nik(nik => \$tmp); \$res->[0] == 200 ? [undef,\$tmp] : [\$res->[1], \$tmp] }",
32             );
33              
34 0           $res;
35             }
36              
37             1;
38             # ABSTRACT:
39              
40             __END__