| 1 | package Data::Sah::Compiler::perl::TH::int; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 6 | ▶ | use 5.010; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | #use Log::Any '$log'; | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 6 | ▶ | use Mo qw(build default); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 6 | ▶ | use Role::Tiny::With; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 6 | extends 'Data::Sah::Compiler::perl::TH::num'; | |||||||||||||||||||||||||||
| 12 | 6 | with 'Data::Sah::Type::int'; | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 6 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |||||||||||||||||||||||||||
| 15 | 6 | our $DATE = '2024-02-16'; # DATE | |||||||||||||||||||||||||||
| 16 | 6 | our $DIST = 'Data-Sah'; # DIST | |||||||||||||||||||||||||||
| 17 | 6 | our $VERSION = '0.917'; # VERSION | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 688 | ▶ | sub handle_type { | ||||||||||||||||||||||||||
|
Subroutine
handle_type: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 20 | 688 | my ($self, $cd) = @_; | |||||||||||||||||||||||||||
| 21 | 688 | my $c = $self->compiler; | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 688 | my $dt = $cd->{data_term}; | |||||||||||||||||||||||||||
| 24 | 688 | ▶ | if ($cd->{args}{core} || $cd->{args}{no_modules}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$cd->{"args"}{"core"} or $cd->{"args"}{"no_modules"}
MC/DC100%2/2
$cd->{"args"}{"core"} or $cd->{"args"}{"no_modules"}
$cd->{"args"}{"core"}
$cd->{"args"}{"no_modules"}
Truth table100%3/3
A or B
A= $cd->{"args"}{"core"}B= $cd->{"args"}{"no_modules"}
| |||||||||||||||||||||||||||||
| 25 | 4 | $cd->{_ccl_check_type} = "$dt =~ ".'/\A[+-]?(?:0|[1-9][0-9]*)\z/'; | |||||||||||||||||||||||||||
| 26 | } else { | ||||||||||||||||||||||||||||
| 27 | 684 | $c->add_sun_module($cd); | |||||||||||||||||||||||||||
| 28 | $cd->{_ccl_check_type} = | ||||||||||||||||||||||||||||
| 29 | 684 | "$cd->{_sun_module}::isint($dt)"; | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 79 | ▶ | sub clause_div_by { | ||||||||||||||||||||||||||
|
Subroutine
clause_div_by: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 34 | 79 | my ($self, $cd) = @_; | |||||||||||||||||||||||||||
| 35 | 79 | my $c = $self->compiler; | |||||||||||||||||||||||||||
| 36 | 79 | my $ct = $cd->{cl_term}; | |||||||||||||||||||||||||||
| 37 | 79 | my $dt = $cd->{data_term}; | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 79 | $c->add_ccl($cd, "$dt % $ct == 0"); | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 6 | ▶ | sub clause_mod { | ||||||||||||||||||||||||||
|
Subroutine
clause_mod: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 43 | 6 | my ($self, $cd) = @_; | |||||||||||||||||||||||||||
| 44 | 6 | my $c = $self->compiler; | |||||||||||||||||||||||||||
| 45 | 6 | my $ct = $cd->{cl_term}; | |||||||||||||||||||||||||||
| 46 | 6 | my $dt = $cd->{data_term}; | |||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 6 | $c->add_ccl($cd, "$dt % $ct\->[0] == $ct\->[1]"); | |||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 6 | 1; | |||||||||||||||||||||||||||
| 52 | # ABSTRACT: perl's type handler for type "int" | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | __END__ | ||||||||||||||||||||||||||||